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

pack-priv Class NIOOutputStreamImpl

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

NIOOutputStream 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 length)

Implements org.glassfish.grizzly.OutputSink.canWrite.

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

public boolean
public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with this stream.

public void
flush()

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this output stream and forces any buffered output bytes to be written out.

private boolean
public void
notifyCanWrite(final WriteHandler handler, final int 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 bytes (or characters).

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 bytes (or characters).

public void
public void
setOutputBuffer(final OutputBuffer outputBuffer)

public void
write(final int b)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.

public void
write(final byte[] b)

Overrides java.io.OutputStream.write.

Writes b.length bytes from the specified byte array to this output stream.

public void
write(final byte[] b, final int off, final int len)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

public void
write(final Buffer buffer)

Implements org.glassfish.grizzly.http.io.BinaryNIOOutputSink.write.

Writes the contents of the specified org.glassfish.grizzly.Buffer.

Field Detail

outputBufferback to summary
private volatile OutputBuffer outputBuffer

Constructor Detail

NIOOutputStreamImplback to summary
pack-priv NIOOutputStreamImpl()

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().

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

Implements org.glassfish.grizzly.OutputSink.canWrite.

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

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.OutputStream.close.

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

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

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Doc from java.io.OutputStream.flush.

Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

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.

Doc from 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 bytes (or characters). Note that once the WriteHandler has been notified, it will not be considered for notification again at a later point in time.

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

Implements org.glassfish.grizzly.OutputSink.notifyCanWrite.

Doc from org.glassfish.grizzly.OutputSink.notifyCanWrite.

Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write more bytes (or characters). Note that once the WriteHandler has been notified, it will not be considered for notification again at a later point in time.

Annotations
@Override
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(final int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public void write(final byte[] b) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(final byte[] b, final int off, final int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
writeback to summary
public void write(final Buffer buffer) throws IOException

Implements org.glassfish.grizzly.http.io.BinaryNIOOutputSink.write.

Doc from org.glassfish.grizzly.http.io.BinaryNIOOutputSink.write.

Writes the contents of the specified org.glassfish.grizzly.Buffer.

Annotations
@Override