Novell exteNd
Director 5.2 API

com.sssw.fw.util
Class EboByteBufferInputStream

java.lang.Object
 |
 +--java.io.InputStream
       |
       +--com.sssw.fw.util.EboByteBufferInputStream

public class EboByteBufferInputStream
extends InputStream

EboByteBufferInputStream This class is similar to the standard ByteArrayInputStream. It differs in that the actual underlying storage mechanism is detachable from the stream object. This allows for efficient transfer of data from an input stream to an output stream without having to copy the data into another buffer (as with the ByteArray streams).


Constructor Summary
EboByteBufferInputStream()
          Creates a new EboByteBufferInputStream
EboByteBufferInputStream(byte[] bytes)
          Creates a new EboByteBufferInputStream from the specified byte array.
EboByteBufferInputStream(EboByteBuffer buffer)
          Creates a new EboByteBufferInputStream using the specified ByteBuffer The cursor for the storage agent is re-set to the start of the buffer.
EboByteBufferInputStream(EboByteBufferOutputStream out)
          Creates a new EboByteBufferInputStream using the specified EboByteBufferOutputStream''s underlying storage agent.
EboByteBufferInputStream(String str)
          Deprecated.  
EboByteBufferInputStream(String str, String enc)
          Creates a new EboByteBufferInputStream from the specified String.
 
Method Summary
 int available()
          Get the size of the available buffer space.
 EboByteBuffer getBuffer()
          Return the underlying ByteBuffer Storage agent.
 int read()
          Read the next byte from the buffer.
 int read(byte[] outbuf)
          Read bytes until the specified output array until it is full.
 int read(byte[] outbuf, int offset, int len)
          Read bytes until the specified output array until it is full.
 EboByteBuffer setBuffer(EboByteBuffer newBuffer)
          Set this Stream objects underlying storage to the new EboByteBuffer storage agent.
 int size()
          Get the current size of the buffer that is in use.
 long skip(long byteCnt)
          Move the cursor position forward by specified number of bytes.
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EboByteBufferInputStream

public EboByteBufferInputStream()
Creates a new EboByteBufferInputStream

EboByteBufferInputStream

public EboByteBufferInputStream(EboByteBuffer buffer)
Creates a new EboByteBufferInputStream using the specified ByteBuffer The cursor for the storage agent is re-set to the start of the buffer.
Parameters:
buffer - the underlying storage for this stream

EboByteBufferInputStream

public EboByteBufferInputStream(String str)
Deprecated.  

Creates a new EboByteBufferInputStream from the specified String
Parameters:
s - the String value

EboByteBufferInputStream

public EboByteBufferInputStream(String str,
                                String enc)
                         throws UnsupportedEncodingException
Creates a new EboByteBufferInputStream from the specified String.
Parameters:
str - the String value
enc - The character encoding
Throws:
UnsupportedEncodingException -  

EboByteBufferInputStream

public EboByteBufferInputStream(byte[] bytes)
Creates a new EboByteBufferInputStream from the specified byte array.
Parameters:
bytes - the byte[] value

EboByteBufferInputStream

public EboByteBufferInputStream(EboByteBufferOutputStream out)
Creates a new EboByteBufferInputStream using the specified EboByteBufferOutputStream''s underlying storage agent. If the output stream does not have a storage agent, create one. The cursor for the storage agent is re-set to the start of the buffer.
Parameters:
out - detach the ByteBuffer from this EboByteBufferOutputStream and use it as our own storage agent.
Method Detail

read

public int read()
Read the next byte from the buffer.
Overrides:
read in class InputStream
Returns:
next byte value or -1 if at end of buffer

read

public int read(byte[] outbuf)
Read bytes until the specified output array until it is full.
Overrides:
read in class InputStream
Parameters:
outbuf - output byte array
Returns:
number of bytes actually read or -1 if end of buffer is reached.

read

public int read(byte[] outbuf,
                int offset,
                int len)
Read bytes until the specified output array until it is full.
Overrides:
read in class InputStream
Parameters:
outbuf - output byte array
offset - starting index to use in the output array
len - the number of bytes to read
Returns:
number of bytes actually read or -1 if end of buffer is reached.

skip

public long skip(long byteCnt)
Move the cursor position forward by specified number of bytes.
Overrides:
skip in class InputStream
Parameters:
byteCnt - requested number of bytes to skip
Returns:
actual number of bytes skipped

available

public int available()
Get the size of the available buffer space.
Overrides:
available in class InputStream
Returns:
the unused size of the buffer

size

public int size()
Get the current size of the buffer that is in use.
Returns:
the size of the buffer currently in use

getBuffer

public EboByteBuffer getBuffer()
Return the underlying ByteBuffer Storage agent. This method will permenantly detach the connection between the underlying storage mechanism and this Stream object.
Returns:
The underlying EboByteBuffer Store

setBuffer

public EboByteBuffer setBuffer(EboByteBuffer newBuffer)
Set this Stream objects underlying storage to the new EboByteBuffer storage agent. Sever the connection to the old storage agent if it is set.
Returns:
The old EboByteBuffer Store or null if not set

Novell exteNd
Director 5.2 API