org.apache.xindice.util
Class ByteArrayInput
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.apache.xindice.util.ByteArrayInput
- public final class ByteArrayInput
- extends ByteArrayInputStream
ByteArrayInput is a wrapper around ByteArrayInputStream that allows read
access to the current position pointer.
- Version:
- $Revision: 571951 $, $Date: 2007-09-02 06:53:51 -0400 (Sun, 02 Sep 2007) $
Method Summary |
InputStream |
getInputStream()
getInputStream returns a newly created ByteArrayInput based on this
instance's data and current position. |
int |
getPos()
getPos returns the current read position in the array. |
void |
setPos(int pos)
setPos sets the current read position in the array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteArrayInput
public ByteArrayInput(byte[] buf)
ByteArrayInput
public ByteArrayInput(byte[] buf,
int pos,
int length)
getPos
public int getPos()
- getPos returns the current read position in the array. This value is not
a relative offset from the start of the original stream, but an absolute
position in the array itself.
- Returns:
- The Array Position
setPos
public void setPos(int pos)
throws IOException
- setPos sets the current read position in the array. This value is not a
relative offset from the start of the original stream, but an absolute
position in the array itself. As such, you can seek back to a position
before the originating position of the InputStream.
- Parameters:
pos
- The Array Position
- Throws:
IOException
- if the position is out of range
getInputStream
public InputStream getInputStream()
- getInputStream returns a newly created ByteArrayInput based on this
instance's data and current position. This is a good alternative to
mark and reset because it allows multiple threads to safely access
the byte array at one time.
- Returns:
- The New ByteArrayInput object
Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.