public class FileDescriptorByteChannel extends Object implements 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(ByteBuffer dst)
Reads data from the native unix file descriptor.
|
int |
write(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(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
dst
- The destination ByteBuffer to place read bytes in.IOException
- If an error occurred during reading.public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
src
- The source ByteBuffer to write to the file descriptor.IOException
- If an error occurred during writing.public boolean isOpen()
public void close() throws IOException
This closes the underlying native file descriptor.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
Copyright © 2001-2015 JRuby. All Rights Reserved.