Top Description Fields Constructors Methods
org.glassfish.grizzly.http.server

pack-priv final Class NIOReaderImpl

extends NIOReader
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Cacheable
Imports
java.io.IOException, java.nio.CharBuffer, org.glassfish.grizzly.Cacheable, .ReadHandler, org.glassfish.grizzly.http.io.InputBuffer, .NIOReader

NIOReader implementation based on InputBuffer.
Authors
Ryan Lubke, Alexey Stashok

Field Summary

Modifier and TypeField and Description
private volatile InputBuffer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

private boolean
public boolean
public boolean
public void
mark(int readAheadLimit)

Overrides java.io.Reader.mark.

Marks the present position in the stream.

public boolean

Returns:

true
markSupported
()

Overrides java.io.Reader.markSupported.

This java.io.Reader implementation supports marking.

public void
notifyAvailable(final ReadHandler handler)

Implements org.glassfish.grizzly.InputSource.notifyAvailable.

Notify the specified ReadHandler when any number of bytes or characters can be read without blocking.

public void
notifyAvailable(final ReadHandler handler, final int size)

Implements org.glassfish.grizzly.InputSource.notifyAvailable.

Notify the specified ReadHandler when the number of bytes that can be read without blocking is greater or equal to the specified size.

public int
read(final CharBuffer target)

Overrides java.io.Reader.read.

Implements java.lang.Readable.read.

Attempts to read characters into the specified character buffer.

public int
read()

Overrides java.io.Reader.read.

Reads a single character.

public int
read(final char[] cbuf)

Overrides java.io.Reader.read.

Reads characters into an array.

public int
read(final char[] cbuf, final int off, final int len)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

public boolean
ready()

Overrides java.io.Reader.ready.

Tells whether this stream is ready to be read.

public int
public void
public void
reset()

Overrides java.io.Reader.reset.

Resets the stream.

public void
setInputBuffer(final InputBuffer inputBuffer)

public long
skip(final long n)

Overrides java.io.Reader.skip.

Skips characters.

Field Detail

inputBufferback to summary
private volatile InputBuffer inputBuffer

Constructor Detail

NIOReaderImplback to summary
pack-priv NIOReaderImpl()

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
initializedback to summary
private boolean initialized()
isFinishedback to summary
public boolean isFinished()

Implements org.glassfish.grizzly.InputSource.isFinished.

Annotations
@Override
isReadyback to summary
public boolean isReady()

Implements org.glassfish.grizzly.InputSource.isReady.

Annotations
@Override
markback to summary
public void mark(int readAheadLimit) throws IOException

Overrides java.io.Reader.mark.

Doc from java.io.Reader.mark.

Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point. Not all character-input streams support the mark() operation.

Annotations
@Override
Exceptions
IOException:
If the stream does not support mark(), or if some other I/O error occurs
markSupportedback to summary
public boolean markSupported()

Overrides java.io.Reader.markSupported.

This java.io.Reader implementation supports marking.

Returns:boolean

true

Annotations
@Override
notifyAvailableback to summary
public void notifyAvailable(final ReadHandler handler)

Implements org.glassfish.grizzly.InputSource.notifyAvailable.

Doc from org.glassfish.grizzly.InputSource.notifyAvailable.

Notify the specified ReadHandler when any number of bytes or characters can be read without blocking.

Invoking this method is equivalent to calling: notifyAvailable(handler, 1).

Annotations
@Override
notifyAvailableback to summary
public void notifyAvailable(final ReadHandler handler, final int size)

Implements org.glassfish.grizzly.InputSource.notifyAvailable.

Doc from org.glassfish.grizzly.InputSource.notifyAvailable.

Notify the specified ReadHandler when the number of bytes that can be read without blocking is greater or equal to the specified size.

Annotations
@Override
readback to summary
public int read(final CharBuffer target) throws IOException

Overrides java.io.Reader.read.

Implements java.lang.Readable.read.

Doc from java.io.Reader.read.

Attempts to read characters into the specified character buffer. The buffer is used as a repository of characters as-is: the only changes made are the results of a put operation. No flipping or rewinding of the buffer is performed. If the length of the specified character buffer is zero, then no characters will be read and zero will be returned.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
readback to summary
public int read() throws IOException

Overrides java.io.Reader.read.

Doc from java.io.Reader.read.

Reads a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.

Subclasses that intend to support efficient single-character input should override this method.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readback to summary
public int read(final char[] cbuf) throws IOException

Overrides java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If the length of cbuf is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readback to summary
public int read(final char[] cbuf, final int off, final int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readyback to summary
public boolean ready() throws IOException

Overrides java.io.Reader.ready.

Doc from java.io.Reader.ready.

Tells whether this stream is ready to be read.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readyDataback to summary
public int readyData()

Implements org.glassfish.grizzly.InputSource.readyData.

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
resetback to summary
public void reset() throws IOException

Overrides java.io.Reader.reset.

Doc from java.io.Reader.reset.

Resets the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().

Annotations
@Override
Exceptions
IOException:
If the stream has not been marked, or if the mark has been invalidated, or if the stream does not support reset(), or if some other I/O error occurs
setInputBufferback to summary
public void setInputBuffer(final InputBuffer inputBuffer)
skipback to summary
public long skip(final long n) throws IOException

Overrides java.io.Reader.skip.

Doc from java.io.Reader.skip.

Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached. If the stream is already at its end before this method is invoked, then no characters are skipped and zero is returned.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs