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

pack-priv final Class NIOWriterImpl

extends NIOWriter
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Cacheable
Imports
java.io.IOException, org.glassfish.grizzly.Cacheable, .WriteHandler, org.glassfish.grizzly.http.io.NIOWriter, .OutputBuffer

NIOWriter implementation.
Authors
Ryan Lubke, Alexey Stashok

Field Summary

Modifier and TypeField and Description
private volatile OutputBuffer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite(final int
specifies the number of characters that require writing
length
)

Implements org.glassfish.grizzly.OutputSink.canWrite.

Deprecated the length parameter will be ignored. Pls use canWrite().

Returns: true if a write to this OutputSink will succeed, otherwise returns false.

public boolean
canWrite()

Implements org.glassfish.grizzly.OutputSink.canWrite.

Returns: true if a write to this OutputSink will succeed, otherwise returns false.

public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.

public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.

private boolean
public void
notifyCanWrite(final WriteHandler
the WriteHandler that should be notified when it's possible to write length characters.
handler
,
final int
the number of characters that require writing.
length
)

Implements org.glassfish.grizzly.OutputSink.notifyCanWrite.

Deprecated the length parameter will be ignored.

Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write length characters.

public void
notifyCanWrite(final WriteHandler
the WriteHandler that should be notified when it's possible to write more characters.
handler
)

Implements org.glassfish.grizzly.OutputSink.notifyCanWrite.

Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write more characters.

public void
public void
setOutputBuffer(final OutputBuffer outputBuffer)

public void
write(int c)

Overrides java.io.Writer.write.

Writes a single character.

public void
write(char[] cbuf)

Overrides java.io.Writer.write.

Writes an array of characters.

public void
write(char[] cbuf, int off, int len)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.

public void
write(String str)

Overrides java.io.Writer.write.

Writes a string.

public void
write(String str, int off, int len)

Overrides java.io.Writer.write.

Writes a portion of a string.

Field Detail

outputBufferback to summary
private volatile OutputBuffer outputBuffer

Constructor Detail

NIOWriterImplback to summary
pack-priv NIOWriterImpl()

Method Detail

canWriteback to summary
public boolean canWrite(final int length)

Implements org.glassfish.grizzly.OutputSink.canWrite.

Deprecated

the length parameter will be ignored. Pls use canWrite().

Parameters
length:int

specifies the number of characters that require writing

Returns:boolean

true if a write to this OutputSink will succeed, otherwise returns false.

Annotations
@Deprecated
@Override
canWriteback to summary
public boolean canWrite()

Implements org.glassfish.grizzly.OutputSink.canWrite.

Returns:boolean

true if a write to this OutputSink will succeed, otherwise returns false.

Annotations
@Override
Since
2.3
closeback to summary
public void close() throws IOException

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
flushback to summary
public void flush() throws IOException

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Writer.flush.

Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
initializedback to summary
private boolean initialized()
notifyCanWriteback to summary
public void notifyCanWrite(final WriteHandler handler, final int length)

Implements org.glassfish.grizzly.OutputSink.notifyCanWrite.

Deprecated

the length parameter will be ignored. Pls. use notifyCanWrite(org.glassfish.grizzly.WriteHandler).

Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write length characters.

Parameters
handler:WriteHandler

the WriteHandler that should be notified when it's possible to write length characters.

length:int

the number of characters that require writing.

Annotations
@Deprecated
@Override
notifyCanWriteback to summary
public void notifyCanWrite(final WriteHandler handler)

Implements org.glassfish.grizzly.OutputSink.notifyCanWrite.

Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write more characters.

Parameters
handler:WriteHandler

the WriteHandler that should be notified when it's possible to write more characters.

Annotations
@Override
Since
2.3
recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
setOutputBufferback to summary
public void setOutputBuffer(final OutputBuffer outputBuffer)
writeback to summary
public void write(int c) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

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

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(char[] cbuf) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes an array of characters.

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

Implements abstract java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of an array of characters.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(String str) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a string.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(String str, int off, int len) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of a string.

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