com.stc.eways.batchext
Class BatchByteArrayInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
com.stc.eways.batchext.BatchByteArrayInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class BatchByteArrayInputStream
- extends java.io.ByteArrayInputStream
This is a simple extension of the java.io.ByteArrayInputStream.
Unfortunately, the ByteArrayInputStream does not support skipping
backwards. That functionality is required for any input stream in
record parsing so this class overrides the skip method to allow
for passing in a negative offset.
- Version:
- $Revision: 1.4 $
- Author:
- jim.fu@sun.com
- See Also:
BatchRecordParser
,
InputStreamFindAdapter
Fields inherited from class java.io.ByteArrayInputStream |
buf, count, mark, pos |
Method Summary |
long |
skip(long n)
Override of the skip method in the base class. |
Methods inherited from class java.io.ByteArrayInputStream |
available, close, mark, markSupported, read, read, reset |
Methods inherited from class java.io.InputStream |
read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BatchByteArrayInputStream
public BatchByteArrayInputStream(byte[] buff)
- Pass-through constructor.
BatchByteArrayInputStream
public BatchByteArrayInputStream(byte[] buff,
int off,
int len)
- Pass-through constructor.
skip
public long skip(long n)
- Override of the skip method in the base class. Allow for skipping
backwards. The override is fairly simple minded. If the 'n' param
is greater than or equal to zero, just call the base class. Otherwise,
if negative, back up the position by that amount. If the resulting
pos is less than zero, adjust to zero. No other range checking is
done.
- Overrides:
skip
in class java.io.ByteArrayInputStream
- Parameters:
n
- The number of bytes to skip.
- Returns:
- If 'n' is greater than or equal to zero, return whatever
the base class returns. If negative, returns 'n'.