ByteBufferInputStream¶
-
public class
ByteBufferInputStream
extends InputStream¶ A ByteBufferInputStream contains an internal buffer that contains direct or non-direct byte buffer that may be read from the stream. Creation Date: 24/10/2006
Author: Twinsen Tsang
Fields¶
buf¶
-
protected ByteBuffer
buf
¶ The internal byte buffer.
Constructors¶
ByteBufferInputStream¶
-
public
ByteBufferInputStream
(ByteBuffer buffer)¶ Creates a
ByteBufferInputStream
so that it usesbuf
as its byte buffer. The buffer array is not copied.Parameters: - buf – the input buffer.
Methods¶
available¶
-
public int
available
()¶ Returns the number of bytes that can be read from this input stream without blocking. The value returned is limit of byte buffer. which is the number of bytes remaining to be read from the input buffer.
Returns: the number of bytes that can be read from the input stream without blocking.
getChannel¶
-
public ReadableByteChannel
getChannel
()¶ Returns the readable byte channel object associated with this byte buffer input stream.
Returns: a readable byte channel for this byte buffer. See also:
java.nio.channels.Channels
markSupported¶
-
public boolean
markSupported
()¶ Mark is support by this InputStream.
Returns: always true
read¶
-
public int
read
()¶ Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.