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 one
access to the underlying array and position pointer.
- Version:
- $Revision: 518460 $, $Date: 2007-03-14 23:47:19 -0400 (Wed, 14 Mar 2007) $
Method Summary |
byte[] |
getArray()
getArray returns the Byte Array. |
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
getArray
public byte[] getArray()
- getArray returns the Byte Array.
- Returns:
- The Byte Array
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.