net.sf.hermesftp.streams
Class BlockModeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by net.sf.hermesftp.streams.BlockModeInputStream
All Implemented Interfaces:
java.io.Closeable, BlockModeConstants, RecordReadSupport

public class BlockModeInputStream
extends java.io.InputStream
implements RecordReadSupport, BlockModeConstants

Reads a stream formatted in block mode, extracts the data contents and registers restart markers.

Author:
Lars Behnke

Field Summary
 
Fields inherited from interface net.sf.hermesftp.streams.BlockModeConstants
DESC_CODE_EOF, DESC_CODE_EOR, DESC_CODE_ERR, DESC_CODE_REST
 
Constructor Summary
BlockModeInputStream(java.io.InputStream is)
          Constructor.
BlockModeInputStream(java.io.InputStream is, byte[] eorMarker, java.util.Map<java.lang.Long,java.lang.Long> restartMarkers)
          Constructor.
 
Method Summary
 java.util.Map<java.lang.Long,java.lang.Long> getRestartMarkers()
          Getter method for the java bean restartMarkers.
 int read()
          
 byte[] readRecord()
          Reads a whole record without delimiters.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockModeInputStream

public BlockModeInputStream(java.io.InputStream is,
                            byte[] eorMarker,
                            java.util.Map<java.lang.Long,java.lang.Long> restartMarkers)
Constructor.

Parameters:
is - the input stream.
eorMarker - The marker bytes for EOR.
restartMarkers - Hash table to be filled with restart markers.

BlockModeInputStream

public BlockModeInputStream(java.io.InputStream is)
Constructor.

Parameters:
is - The input stream.
Method Detail

readRecord

public byte[] readRecord()
                  throws java.io.IOException
Reads a whole record without delimiters.

Specified by:
readRecord in interface RecordReadSupport
Returns:
The record.
Throws:
java.io.IOException - Throws if reading fails.

read

public int read()
         throws java.io.IOException

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

getRestartMarkers

public java.util.Map<java.lang.Long,java.lang.Long> getRestartMarkers()
Getter method for the java bean restartMarkers.

Returns:
Returns the value of the java bean restartMarkers.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.