/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
/** * Returns a writer that encodes characters with the specified * {@code encoder} and sends the bytes to the specified channel. * * @param channel * the Channel to write to. * @param encoder * the CharsetEncoder to be used. * @param minBufferCapacity * the minimum size of the byte buffer, -1 means to use the * default size. * @return the writer. */ public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { /* * This method doesn't honor minBufferCapacity. Ignoring that parameter * saves us from having to add a hidden constructor to OutputStreamWriter. */ return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
@Override public synchronized void write(int oneByte) throws IOException { byte[] wrappedByte = { (byte) oneByte }; write(wrappedByte); }
/** * Returns an output stream on the given channel. The resulting stream has * the following properties: * <ul> * <li>If the stream is closed, then the underlying channel is closed as * well.</li> * <li>It is thread safe.</li> * <li>It throws an {@link IllegalBlockingModeException} if the channel is * in non-blocking mode and {@code write} is called.</li> * <li>It is not buffered.</li> * </ul> * * @param channel * the channel to be wrapped by an OutputStream. * @return an OutputStream that puts bytes onto the given byte channel. */ public static OutputStream newOutputStream(WritableByteChannel channel) { return new ChannelOutputStream(channel); }