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 void
awaitReadable
(ReadableByteChannel channel) static void
awaitWritable
(WritableByteChannel channel) static int
blockingRead
(ReadableByteChannel channel, ByteBuffer buf) static int
blockingWrite
(WritableByteChannel channel, ByteBuffer buf) static final BlockingIO.Condition
newCondition
(Channel channel, int ops) static final BlockingIO.Condition
newCondition
(Channel channel, int ops, Object monitor) static int
read
(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) static void
static int
write
(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:
InterruptedException
IOException
-
awaitReadable
public static void awaitReadable(ReadableByteChannel channel) throws InterruptedException, IOException - Throws:
InterruptedException
IOException
-
awaitWritable
public static void awaitWritable(WritableByteChannel channel) throws InterruptedException, IOException - Throws:
InterruptedException
IOException
-
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
-