org.miv.mbox.net
Class PositionableByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by org.miv.mbox.net.PositionableByteArrayInputStream
All Implemented Interfaces:
Closeable

public class PositionableByteArrayInputStream
extends ByteArrayInputStream

Descendant of ByteArrayInputStream that allows to change the offset and length. The standard ByteArrayInputStream can only wrap a fixed part of its underlying byte array (this byte array being managed by another source). As the ByteArrayInputStream is used as source for other streams, it is not possible to create a new ByteArrayInputStream if the part of the underlying byte array used to read changes. Therefore this class allows to change the offset and length of the part to use. Furthermore, it also allows to change the underlying byte array.

Since:
20041103
Author:
Antoine Dutot

Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
PositionableByteArrayInputStream(byte[] buf)
           
PositionableByteArrayInputStream(byte[] buf, int offset, int length)
           
 
Method Summary
 void changeBuffer(byte[] buf)
           
 int getPos()
           
 void setPos(int pos, int count)
           
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionableByteArrayInputStream

public PositionableByteArrayInputStream(byte[] buf)

PositionableByteArrayInputStream

public PositionableByteArrayInputStream(byte[] buf,
                                        int offset,
                                        int length)
Method Detail

getPos

public int getPos()

setPos

public void setPos(int pos,
                   int count)

changeBuffer

public void changeBuffer(byte[] buf)


Copyright © 2011. All Rights Reserved.