Package org.jruby.util.io
Class BlockingIO
java.lang.Object
org.jruby.util.io.BlockingIO
A Utility class to emulate blocking I/O operations on non-blocking channels.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidawaitReadable(ReadableByteChannel channel) static voidawaitWritable(WritableByteChannel channel) static intblockingRead(ReadableByteChannel channel, ByteBuffer buf) static intblockingWrite(WritableByteChannel channel, ByteBuffer buf) static final BlockingIO.ConditionnewCondition(Channel channel, int ops) static final BlockingIO.ConditionnewCondition(Channel channel, int ops, Object monitor) static intread(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) static voidstatic intwrite(WritableByteChannel channel, ByteBuffer buf, boolean blocking)
-
Constructor Details
-
BlockingIO
public BlockingIO()
-
-
Method Details
-
newCondition
public static final BlockingIO.Condition newCondition(Channel channel, int ops, Object monitor) throws IOException - Throws:
IOException
-
newCondition
- Throws:
IOException
-
waitForIO
- Throws:
InterruptedExceptionIOException
-
awaitReadable
public static void awaitReadable(ReadableByteChannel channel) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
awaitWritable
public static void awaitWritable(WritableByteChannel channel) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
read
public static int read(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException - Throws:
IOException
-
write
public static int write(WritableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException - Throws:
IOException
-
blockingRead
- Throws:
IOException
-
blockingWrite
- Throws:
IOException
-