Package com.yahoo.container.jdisc
Class ContentChannelOutputStream
java.lang.Object
java.io.OutputStream
com.yahoo.container.jdisc.ContentChannelOutputStream
- All Implemented Interfaces:
com.yahoo.io.WritableByteTransmitter,Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
MaxPendingContentChannelOutputStream
public class ContentChannelOutputStream
extends OutputStream
implements com.yahoo.io.WritableByteTransmitter
A buffered stream wrapping a ContentChannel.
- Author:
- Steinar Knutsen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flush the internal buffers, does not touch the ContentChannel.voidflush()Flush the internal buffers, does not touch the ContentChannel.voidnonCopyingWrite(byte[] b) Buffered write the contents of the array to this stream, transferring ownership of that array to this stream.voidnonCopyingWrite(byte[] b, int off, int len) Buffered write of the contents of the array to this stream, transferring ownership of that array to this stream.voidsend(ByteBuffer src) Write a ByteBuffer to the wrapped ContentChannel.protected voidsend(ByteBuffer src, CompletionHandler completionHandler) voidwrite(byte[] b) Buffered write the contents of the array to this stream, copying the contents of the given array to this stream.voidwrite(byte[] b, int off, int len) Buffered write of the contents of the array to this stream, copying the contents of the given array to this stream.voidwrite(int b) Buffered write of a single byte.longwritten()Returns the number of bytes written to this streamMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ContentChannelOutputStream
-
-
Method Details
-
write
Buffered write of a single byte.- Specified by:
writein classOutputStream- Throws:
IOException
-
close
Flush the internal buffers, does not touch the ContentChannel.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
Flush the internal buffers, does not touch the ContentChannel.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
Buffered write of the contents of the array to this stream, copying the contents of the given array to this stream. It is in other words safe to recycle the arrayb.- Overrides:
writein classOutputStream- Throws:
IOException
-
write
Buffered write the contents of the array to this stream, copying the contents of the given array to this stream. It is in other words safe to recycle the arrayb.- Overrides:
writein classOutputStream- Throws:
IOException
-
nonCopyingWrite
Buffered write of the contents of the array to this stream, transferring ownership of that array to this stream. It is in other words not safe to recycle the arrayb.- Throws:
IOException
-
nonCopyingWrite
Buffered write the contents of the array to this stream, transferring ownership of that array to this stream. It is in other words not safe to recycle the arrayb.- Throws:
IOException
-
send
Write a ByteBuffer to the wrapped ContentChannel. Do invokeflush()before send(ByteBuffer) to avoid garbled output if the stream API has been accessed before using the ByteBuffer based API. As with ContentChannel, this transfers ownership of the ByteBuffer to this stream.- Specified by:
sendin interfacecom.yahoo.io.WritableByteTransmitter- Throws:
IOException
-
send
- Throws:
IOException
-
written
public long written()Returns the number of bytes written to this stream
-