CADI.Common.LogicalTarget.JPEG2000.Codestream
Class PacketHeaderDataInputStream

java.lang.Object
  extended by CADI.Common.LogicalTarget.JPEG2000.Codestream.PacketHeaderDataInputStream

public class PacketHeaderDataInputStream
extends java.lang.Object

This class implements a data input read to be read from the packet headers decoder. It abstracts from reading and discarting the 0xFF bytes which can be found in the packet header stream. Therefore, each call to the getTagBit() method returns a valid bit.

Version:
1.0.1 2008/12/27
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  BufferedDataInputStream bufferedDataInputStream
           
private  boolean foundFF
          Boolean that indicates if a 0xFF has been found in the bytestream.
private  byte nextByte
          Variable used by the getTagBit function, needed to get bit by bit the packet data.
private  int numBit
          Variable used by the getTagBit function, needed to get bit by bit the data input stream Only positive values allowed.
private  byte readByte
          Variable used by the getTagBit function, needed to get bit by bit the packet data.
 
Constructor Summary
PacketHeaderDataInputStream()
          Constructor.
PacketHeaderDataInputStream(BufferedDataInputStream bufferedDataInputStream)
          Constructor
 
Method Summary
 int getTagBit()
          Retrieves a bit from the file.
 void list(java.io.PrintStream out)
          Prints this Packet Header Data Output Stream out to the specified output stream.
 void resetGetTagBit()
          Reset the getTagBit flags to reinitialize the reading.
 void setInput(BufferedDataInputStream bufferedDataInputStream)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bufferedDataInputStream

private BufferedDataInputStream bufferedDataInputStream

numBit

private int numBit
Variable used by the getTagBit function, needed to get bit by bit the data input stream

Only positive values allowed.


foundFF

private boolean foundFF
Boolean that indicates if a 0xFF has been found in the bytestream.

True indicates that a 0xFF byte has been found.


readByte

private byte readByte
Variable used by the getTagBit function, needed to get bit by bit the packet data. This is the byte readed.

Byte from the packet data.


nextByte

private byte nextByte
Variable used by the getTagBit function, needed to get bit by bit the packet data. This variable is used to save the next byte readed when detected an 0xFF (stuffing).

Byte from the packet data.

Constructor Detail

PacketHeaderDataInputStream

public PacketHeaderDataInputStream()
Constructor.


PacketHeaderDataInputStream

public PacketHeaderDataInputStream(BufferedDataInputStream bufferedDataInputStream)
Constructor

Parameters:
bufferedDataInputStream -
Method Detail

setInput

public void setInput(BufferedDataInputStream bufferedDataInputStream)
Parameters:
bufferedDataInputStream -

getTagBit

public int getTagBit()
              throws java.io.EOFException,
                     java.io.IOException
Retrieves a bit from the file. Function used in PacketDeheading.

Returns:
the readed bit
Throws:
java.io.EOFException - when end of file is reached
java.io.IOException - if an I/O error occurs

resetGetTagBit

public void resetGetTagBit()
Reset the getTagBit flags to reinitialize the reading.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

list

public void list(java.io.PrintStream out)
Prints this Packet Header Data Output Stream out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


CADI - Copyright (C) 2007
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) (contact)