Module com.github.akurilov.commons
Class OutputStreamWrapperChannel
- java.lang.Object
-
- com.github.akurilov.commons.io.util.BufferedByteChannelBase
-
- com.github.akurilov.commons.io.util.OutputStreamWrapperChannel
-
- All Implemented Interfaces:
BufferedByteChannel,BufferedWritableByteChannel,java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.WritableByteChannel
public class OutputStreamWrapperChannel extends BufferedByteChannelBase implements BufferedWritableByteChannel
-
-
Field Summary
-
Fields inherited from class com.github.akurilov.commons.io.util.BufferedByteChannelBase
bb, buffer, REUSABLE_BUFF_SIZE_MAX, REUSABLE_BUFF_SIZE_MIN
-
-
Constructor Summary
Constructors Constructor Description OutputStreamWrapperChannel(java.io.OutputStream out, int buffSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static BufferedWritableByteChannelgetThreadLocalInstance(java.io.OutputStream out, long remainingSize)Wraps the given output stream into the special stateless and reusable (thread local) byte channelintwrite(java.nio.ByteBuffer src)-
Methods inherited from class com.github.akurilov.commons.io.util.BufferedByteChannelBase
buffer, isOpen
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.akurilov.commons.io.util.BufferedByteChannel
buffer
-
-
-
-
Method Detail
-
write
public final int write(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writein interfacejava.nio.channels.WritableByteChannel- Throws:
java.io.IOException
-
getThreadLocalInstance
public static BufferedWritableByteChannel getThreadLocalInstance(java.io.OutputStream out, long remainingSize) throws java.lang.IllegalStateException
Wraps the given output stream into the special stateless and reusable (thread local) byte channel- Parameters:
out- the output stream to wrap into the byte channelremainingSize- the estimated size of the data to be written to the given output- Returns:
- writable byte channel
- Throws:
java.lang.IllegalStateException- if negative remaining size is specified
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-