public class FileDescriptorByteChannel
extends java.lang.Object
implements java.nio.channels.ByteChannel
Constructor and Description |
---|
FileDescriptorByteChannel(Ruby runtime,
int fd)
Creates a new FileDescriptorByteChannel.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Channel.
|
boolean |
isOpen()
Tests if the ByteChannel is open.
|
int |
read(java.nio.ByteBuffer dst)
Reads data from the native unix file descriptor.
|
int |
write(java.nio.ByteBuffer src)
Writes data to the native unix file descriptor.
|
public FileDescriptorByteChannel(Ruby runtime, int fd)
fd
- The native unix fd to read/write.public int read(java.nio.ByteBuffer dst) throws java.io.IOException
read
in interface java.nio.channels.ReadableByteChannel
dst
- The destination ByteBuffer to place read bytes in.java.io.IOException
- If an error occurred during reading.public int write(java.nio.ByteBuffer src) throws java.io.IOException
write
in interface java.nio.channels.WritableByteChannel
src
- The source ByteBuffer to write to the file descriptor.java.io.IOException
- If an error occurred during writing.public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public void close() throws java.io.IOException
This closes the underlying native file descriptor.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException
Copyright © 2001-2018 JRuby. All Rights Reserved.