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 java.io.ByteArrayInputStream
ByteArrayInput is a wrapper around ByteArrayInputStream that allows one
access to the underlying array and position pointer.
Method Summary |
byte[] |
getArray()
getArray returns the Byte Array. |
java.io.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.io.ByteArrayInputStream |
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.io.InputStream |
read |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteArrayInput
public ByteArrayInput(byte[] buf)
ByteArrayInput
public ByteArrayInput(byte[] buf,
int pos,
int count)
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 java.io.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:
java.io.IOException
- if the position is out of range
getArray
public byte[] getArray()
- getArray returns the Byte Array.
- Returns:
- The Byte Array
getInputStream
public java.io.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-2001 The Apache Software Foundation