com.bigzip.plugin.compression.io
Class ArchiveStream

java.lang.Object
  |
  +--com.bigzip.plugin.compression.io.AbstractStream
        |
        +--com.bigzip.plugin.compression.io.ArchiveStream

public class ArchiveStream
extends AbstractStream


Field Summary
protected  boolean entryEOF
          this flag is set to true after EOF has reached for one entry
 
Fields inherited from class com.bigzip.plugin.compression.io.AbstractStream
clientStream
 
Constructor Summary
ArchiveStream(AbstractStream clientStream)
          For use of customised checksum routines
 
Method Summary
 int available()
          Returns 0 after EOF has reached for the current entry data, otherwise always return 1.
 boolean isEntryEOF()
           
 int read()
          Reads a byte of data from this file.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this file into an array of bytes.
 void setEntryEOF(boolean b)
          Resets the entryEOF state so that the next entry can be read.
 int skipBytes(int n)
          Skips specified number of bytes in the current entry.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this file.
 void write(int b)
          Writes the specified byte to this file.
 
Methods inherited from class com.bigzip.plugin.compression.io.AbstractStream
close, ensureOpen, finish, getFilePointer, isClosed, length, read, readBoolean, readByte, readChar, readDirect, readDirect, readDouble, readFloat, readFully, readInt, readInt, readLine, readLong, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setClientStream, setClosed, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDirect, writeDirect, writeDouble, writeFloat, writeFully, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entryEOF

protected boolean entryEOF
this flag is set to true after EOF has reached for one entry
Constructor Detail

ArchiveStream

public ArchiveStream(AbstractStream clientStream)
For use of customised checksum routines
Method Detail

read

public int read()
         throws java.io.IOException
Description copied from class: AbstractStream
Reads a byte of data from this file. This method blocks if no input is yet available.
Overrides:
read in class AbstractStream
Following copied from class: com.bigzip.plugin.compression.io.AbstractStream
Returns:
the next byte of data, or -1 if the end of the file is reached.

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Description copied from class: AbstractStream
Reads up to len bytes of data from this file into an array of bytes. This method blocks until at least one byte of input is available.
Overrides:
read in class AbstractStream
Following copied from class: com.bigzip.plugin.compression.io.AbstractStream
Parameters:
b - the buffer into which the data is read.
off - the start offset of the data.
len - the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.

write

public void write(int b)
           throws java.io.IOException
Description copied from class: AbstractStream
Writes the specified byte to this file.
Overrides:
write in class AbstractStream
Following copied from class: com.bigzip.plugin.compression.io.AbstractStream
Parameters:
b - the byte to be written.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from class: AbstractStream
Writes len bytes from the specified byte array starting at offset off to this file.
Overrides:
write in class AbstractStream
Following copied from class: com.bigzip.plugin.compression.io.AbstractStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.

available

public int available()
              throws java.io.IOException
Returns 0 after EOF has reached for the current entry data, otherwise always return 1.

Programs should not count on this method to return the actual number of bytes that could be read without blocking.

Returns:
1 before EOF and 0 after EOF has reached for current entry.
Throws:
java.io.IOException - if an I/O error occurs.

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Skips specified number of bytes in the current entry. If the entry's EOF is reached then entryEOF is set to true and the skipping is stopped.
Overrides:
skipBytes in class AbstractStream
Parameters:
n - the number of bytes to skip
Returns:
the actual number of bytes skipped
Throws:
java.io.IOException - if an I/O error has occurred
java.lang.IllegalArgumentException - if n < 0

setEntryEOF

public void setEntryEOF(boolean b)
Resets the entryEOF state so that the next entry can be read.
Parameters:
b - entryEOF state

isEntryEOF

public boolean isEntryEOF()
Returns:
where or not the end of the entry has been reached.