org.wkb4j.engine
Class ResetableByteArrayInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.ByteArrayInputStream
|
+--org.wkb4j.engine.ResetableByteArrayInputStream
- public class ResetableByteArrayInputStream
- extends java.io.ByteArrayInputStream
ResetableByteArrayInputStream
is a ByteArrayInputStream
where
the internal buffer can be reinitialized with a new input buffer, removing the need for destroying
and recreating a different ByteArrayInputStream
for each input buffer. It is especially useful
if several other InputStreams are layered on top of it.
- Version:
- $Revision: 1.4 $ $Date: 2003/06/14 22:31:26 $
- Author:
- David Garnier
Creation date: 3 juil. 2002 00:08:32
Fields inherited from class java.io.ByteArrayInputStream |
buf, count, mark, pos |
Fields inherited from class java.io.InputStream |
|
Method Summary |
int |
read()
This method was subclassed here because in is synchronized in the default implementation and we don't need that.
|
void |
reset(byte[] newBuf)
Reset an ResetableByteArrayInputStream to its prime state. |
void |
reset(byte[] newBuf,
int offset,
int length)
Reset an ResetableByteArrayInputStream to its prime state. |
Methods inherited from class java.io.ByteArrayInputStream |
available, close, mark, markSupported, read, reset, skip |
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 |
ResetableByteArrayInputStream
public ResetableByteArrayInputStream(byte[] buf)
- Creates a
ResetableByteArrayInputStream
so that it uses buf
as its
buffer array.
The buffer array is not copied.
The initial value of pos
is 0
and the initial value
of count
is the length of
buf
.
- Parameters:
buf
- the input buffer.
ResetableByteArrayInputStream
public ResetableByteArrayInputStream(byte[] buf,
int offset,
int length)
- Creates
ResetableByteArrayInputStream
that uses buf
as its
buffer array. The initial value of pos
is offset
and the initial value
of count
is offset+len
.
The buffer array is not copied. The buffer's mark is
set to the specified offset.
- Parameters:
buf
- the input buffer.offset
- the offset in the buffer of the first byte to read.length
- the maximum number of bytes to read from the buffer.
reset
public final void reset(byte[] newBuf)
- Reset an ResetableByteArrayInputStream to its prime state. When this method return,
this ResetableByteArrayInputStream is in exactly the same state as if it was just instantiated with the same
arguments.
reset
public final void reset(byte[] newBuf,
int offset,
int length)
- Reset an ResetableByteArrayInputStream to its prime state. When this method return,
this ResetableByteArrayInputStream is in exactly the same state as if it was just instantiated with the same
arguments.
- Parameters:
offset
- the offset in the buffer of the first byte to read.length
- the maximum number of bytes to read from the buffer.
read
public final int read()
- This method was subclassed here because in is synchronized in the default implementation and we don't need that.
See the general contract for read in ByteArrayInputStream.
- Overrides:
read
in class java.io.ByteArrayInputStream
Copyright © 2002-2003 David Garnier. All Rights Reserved.