|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
com.sun.enterprise.web.connector.grizzly.ByteBufferInputStream
public class ByteBufferInputStream
This class implement IO stream operations on top of a ByteBuffer.
Under the hood, this class use a temporary Selector pool to for reading
bytes when the client ask for more and the current Selector is not yet ready.
| Field Summary | |
|---|---|
protected ByteBuffer |
byteBuffer
The wrapped ByteBuffer
|
protected SelectionKey |
key
The SelectionKey used by this stream. |
protected int |
readTimeout
The time to wait before timing out when reading bytes |
protected int |
readTry
Number of times to retry before return EOF |
| Constructor Summary | |
|---|---|
ByteBufferInputStream()
|
|
ByteBufferInputStream(ByteBuffer byteBuffer)
|
|
| Method Summary | |
|---|---|
int |
available()
Return the available bytes |
void |
close()
Close this stream. |
protected int |
doRead()
Read bytes using the read ReadSelector |
ByteBuffer |
getByteBuffer()
Get the wrapped ByteBuffer |
static int |
getDefaultReadTimeout()
|
int |
getReadTimeout()
Return the timeout between two consecutives Selector.select() when a temporary Selector is used. |
boolean |
markSupported()
Return true if mark is supported. |
int |
read()
Read the first byte from the wrapped ByteBuffer. |
int |
read(byte[] b)
Read the bytes from the wrapped ByteBuffer. |
int |
read(byte[] b,
int offset,
int length)
Read the first byte of the wrapped ByteBuffer. |
int |
read(ByteBuffer bb)
Read the first byte of the wrapped ByteBuffer. |
static int |
readBlocking(SocketChannel socketChannel,
ByteBuffer byteBuffer,
int readTimeout)
|
void |
recycle()
Recycle this object. |
void |
setByteBuffer(ByteBuffer byteBuffer)
Set the wrapped ByteBuffer |
static void |
setDefaultReadTimeout(int aDefaultReadTimeout)
|
void |
setReadTimeout(int rt)
Set the timeout between two consecutives Selector.select() when a temporary Selector is used. |
void |
setSelectionKey(SelectionKey key)
Set the SelectionKey used to reads bytes. |
| Methods inherited from class java.io.InputStream |
|---|
mark, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ByteBuffer byteBuffer
ByteBuffer
protected SelectionKey key
SelectionKey used by this stream.
protected int readTimeout
protected int readTry
| Constructor Detail |
|---|
public ByteBufferInputStream()
public ByteBufferInputStream(ByteBuffer byteBuffer)
| Method Detail |
|---|
public void setByteBuffer(ByteBuffer byteBuffer)
ByteBuffer
byteBuffer - The wrapped byteBufferpublic ByteBuffer getByteBuffer()
ByteBuffer
public int available()
available in class InputStreampublic void close()
close in interface Closeableclose in class InputStreampublic boolean markSupported()
markSupported in class InputStream
public int read()
throws IOException
ByteBuffer.
read in class InputStreamIOException
public int read(byte[] b)
throws IOException
ByteBuffer.
read in class InputStreamIOException
public int read(byte[] b,
int offset,
int length)
throws IOException
ByteBuffer.
read in class InputStreamIOException
public int read(ByteBuffer bb)
throws IOException
ByteBuffer.
IOExceptionpublic void recycle()
public void setSelectionKey(SelectionKey key)
SelectionKey used to reads bytes.
protected int doRead()
throws IOException
ReadSelector
IOExceptionpublic int getReadTimeout()
public void setReadTimeout(int rt)
public static int getDefaultReadTimeout()
public static void setDefaultReadTimeout(int aDefaultReadTimeout)
public static int readBlocking(SocketChannel socketChannel,
ByteBuffer byteBuffer,
int readTimeout)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||