GiciStream
Class IODataStream

java.lang.Object
  extended by GiciStream.IODataStream

public class IODataStream
extends java.lang.Object

This class supports the writting and reading of values from/to a BitStream using different data types(boolean, byte, short, integer, integer specifying the number of bits to write, long, float, double). This class is not instantiable, all the functions are declared static.

Version:
1.0
Author:
Group on Interactive Coding of Images (GICI)

Constructor Summary
IODataStream()
           
 
Method Summary
static int readBitsSignedInteger(BitStream IODataBitStream, int numBits)
          Reads an signed integer from a BitStream and returns its value.
static int readBitsUnsignedInteger(BitStream IODataBitStream, int numBits)
          Reads a number of bits of an integer from a BitStream and returns its value.
static boolean readBoolean(BitStream IODataBitStream)
          Reads a boolean from a BitStream and returns its value.
static byte readByte(BitStream IODataBitStream)
          Reads a byte from a BitStream and returns its value.
static double readDouble(BitStream IODataBitStream)
          Reads a double from a BitStream and returns its value.
static float readFloat(BitStream IODataBitStream)
          Reads a float from a BitStream and returns its value.
static int readInteger(BitStream IODataBitStream)
          Reads an integer from a BitStream and returns its value.
static long readLong(BitStream IODataBitStream)
          Reads a long from a BitStream and returns its value.
static short readShort(BitStream IODataBitStream)
          Reads a short from a BitStream and returns its value.
static void writeBitsSignedInteger(BitStream IODataBitStream, int value, int numBits)
          Write the bits of an signed int including the sign bit, to the bitstream starting at length MSB position of the int passed.
static void writeBitsUnsignedInteger(BitStream IODataBitStream, int value, int numBits)
          Write a number of bits of an unsigned int to a bitstream.
static void writeBoolean(BitStream IODataBitStream, boolean value)
          Write a boolean to a BitStream.
static void writeByte(BitStream IODataBitStream, byte value)
          Write a byte to a BitStream.
static void writeDouble(BitStream IODataBitStream, double value)
          Write a double to a BitStream.
static void writeFloat(BitStream IODataBitStream, float value)
          Write a float to a BitStream.
static void writeInteger(BitStream IODataBitStream, int value)
          Write an integer to a BitStream.
static void writeLong(BitStream IODataBitStream, long value)
          Write a long to a BitStream.
static void writeShort(BitStream IODataBitStream, short value)
          Write a short to a BitStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IODataStream

public IODataStream()
Method Detail

writeBoolean

public static void writeBoolean(BitStream IODataBitStream,
                                boolean value)
Write a boolean to a BitStream.

Parameters:
value - its the boolean to insert
IODataBitStream - its the BitStream to insert data readed

readBoolean

public static boolean readBoolean(BitStream IODataBitStream)
                           throws WarningException
Reads a boolean from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the boolean read
Throws:
WarningException - when the input BitStream end is reached

writeByte

public static void writeByte(BitStream IODataBitStream,
                             byte value)
Write a byte to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - its the byte to insert

readByte

public static byte readByte(BitStream IODataBitStream)
                     throws WarningException
Reads a byte from a BitStream and returns its value.

Parameters:
IODataBitStream - it is the BitStream to read the data
Returns:
the byte read
Throws:
WarningException - when the input BitStream end is reached

writeShort

public static void writeShort(BitStream IODataBitStream,
                              short value)
Write a short to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - it is the short to insert

readShort

public static short readShort(BitStream IODataBitStream)
                       throws WarningException
Reads a short from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the short readed
Throws:
WarningException - when the input BitStream end is reached

writeInteger

public static void writeInteger(BitStream IODataBitStream,
                                int value)
Write an integer to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - its the integer to insert

readInteger

public static int readInteger(BitStream IODataBitStream)
                       throws WarningException
Reads an integer from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the integer readed
Throws:
WarningException - when the input BitStream end is reached

writeLong

public static void writeLong(BitStream IODataBitStream,
                             long value)
Write a long to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - its the long to insert

readLong

public static long readLong(BitStream IODataBitStream)
                     throws WarningException
Reads a long from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the long readed
Throws:
WarningException - when the input BitStream end is reached

writeFloat

public static void writeFloat(BitStream IODataBitStream,
                              float value)
Write a float to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - its the float to insert

readFloat

public static float readFloat(BitStream IODataBitStream)
                       throws WarningException
Reads a float from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the float read
Throws:
WarningException - when the input BitStream end is reached

writeDouble

public static void writeDouble(BitStream IODataBitStream,
                               double value)
Write a double to a BitStream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - its the double to insert

readDouble

public static double readDouble(BitStream IODataBitStream)
                         throws WarningException
Reads a double from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
Returns:
the double read
Throws:
WarningException - when the input BitStream end is reached

writeBitsUnsignedInteger

public static void writeBitsUnsignedInteger(BitStream IODataBitStream,
                                            int value,
                                            int numBits)
                                     throws WarningException
Write a number of bits of an unsigned int to a bitstream.

Parameters:
IODataBitStream - its the BitStream to write the data
value - a integer that contains the sequence of values to be inserted
numBits - a integer that indicates the number of bits to take into account
Throws:
WarningException - when the value cannot be saved with the passed number of bits or is negative

readBitsUnsignedInteger

public static int readBitsUnsignedInteger(BitStream IODataBitStream,
                                          int numBits)
                                   throws WarningException
Reads a number of bits of an integer from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
numBits - the number of bits of the integer
Returns:
the integer read
Throws:
WarningException - when the input BitStream end is reached

writeBitsSignedInteger

public static void writeBitsSignedInteger(BitStream IODataBitStream,
                                          int value,
                                          int numBits)
                                   throws WarningException
Write the bits of an signed int including the sign bit, to the bitstream starting at length MSB position of the int passed.

Parameters:
IODataBitStream - its the BitStream to write the data
value - a integer that contains the sequence of values to be inserted
numBits - a integer that indicates the number of bits to take into account the sign is included
Throws:
WarningException - when the value cannot be saved with the passed number of bits

readBitsSignedInteger

public static int readBitsSignedInteger(BitStream IODataBitStream,
                                        int numBits)
                                 throws WarningException
Reads an signed integer from a BitStream and returns its value.

Parameters:
IODataBitStream - its the BitStream to read the data
numBits - the number of bits of the integer includign the sign bit
Returns:
the integer read
Throws:
WarningException - when the input BitStream end is reached


TER - Copyright (C) 2006
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) - UAB (Spain)