SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; // Set non-blocking channel.configureBlocking(false); }
SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; // Set non-blocking channel.configureBlocking(false); }
/** * Create a new input stream with the given timeout. If the timeout * is zero, it will be treated as infinite timeout. The socket's * channel will be configured to be non-blocking. * * @param channel * Channel for reading, should also be a {@link SelectableChannel}. * The channel will be configured to be non-blocking. * @param timeout * timeout in milliseconds. must not be negative. * @throws IOException */ public SocketInputStream(ReadableByteChannel channel, long timeout) throws IOException { SocketIOWithTimeout.checkChannelValidity(channel); reader = new Reader(channel, timeout); }
/** * Create a new input stream with the given timeout. If the timeout * is zero, it will be treated as infinite timeout. The socket's * channel will be configured to be non-blocking. * * @param channel * Channel for reading, should also be a {@link SelectableChannel}. * The channel will be configured to be non-blocking. * @param timeout * timeout in milliseconds. must not be negative. * @throws IOException */ public SocketInputStream(ReadableByteChannel channel, long timeout) throws IOException { SocketIOWithTimeout.checkChannelValidity(channel); reader = new Reader(channel, timeout); }
/** * Create a new ouput stream with the given timeout. If the timeout * is zero, it will be treated as infinite timeout. The socket's * channel will be configured to be non-blocking. * * @param channel * Channel for writing, should also be a {@link SelectableChannel}. * The channel will be configured to be non-blocking. * @param timeout * timeout in milliseconds. must not be negative. * @throws IOException */ public SocketOutputStream(WritableByteChannel channel, long timeout) throws IOException { SocketIOWithTimeout.checkChannelValidity(channel); writer = new Writer(channel, timeout); }
/** * Create a new ouput stream with the given timeout. If the timeout * is zero, it will be treated as infinite timeout. The socket's * channel will be configured to be non-blocking. * * @param channel * Channel for writing, should also be a {@link SelectableChannel}. * The channel will be configured to be non-blocking. * @param timeout * timeout in milliseconds. must not be negative. * @throws IOException */ public SocketOutputStream(WritableByteChannel channel, long timeout) throws IOException { SocketIOWithTimeout.checkChannelValidity(channel); writer = new Writer(channel, timeout); }