@Deprecated public class ChannelDescriptor extends Object
Constructor and Description |
---|
ChannelDescriptor(Channel channel)
Deprecated.
Construct a new ChannelDescriptor with the given channel, file number,
and file descriptor object.
|
ChannelDescriptor(Channel channel,
FileDescriptor fileDescriptor)
Deprecated.
Construct a new ChannelDescriptor with the given channel, file number,
and file descriptor object.
|
ChannelDescriptor(Channel channel,
int fileno,
FileDescriptor fileDescriptor)
Deprecated.
|
ChannelDescriptor(Channel channel,
ModeFlags originalModes)
Deprecated.
Construct a new ChannelDescriptor with the given channel, file number, mode flags,
and file descriptor object.
|
ChannelDescriptor(Channel channel,
ModeFlags originalModes,
FileDescriptor fileDescriptor)
Deprecated.
Construct a new ChannelDescriptor with the given channel, file number, mode flags,
and file descriptor object.
|
ChannelDescriptor(Channel channel,
ModeFlags originalModes,
FileDescriptor fileDescriptor,
boolean isInAppendMode)
Deprecated.
Construct a new ChannelDescriptor with the given channel, file number, mode flags,
and file descriptor object.
|
ChannelDescriptor(InputStream baseInputStream,
ModeFlags originalModes)
Deprecated.
Special constructor to create the ChannelDescriptor out of the stream, file number,
mode flags, and file descriptor object.
|
ChannelDescriptor(InputStream baseInputStream,
ModeFlags originalModes,
FileDescriptor fileDescriptor)
Deprecated.
Special constructor to create the ChannelDescriptor out of the stream, file number,
mode flags, and file descriptor object.
|
Modifier and Type | Method and Description |
---|---|
void |
checkNewModes(ModeFlags newModes)
Deprecated.
Check whether a specified set of mode flags is a superset of this
descriptor's original set of mode flags.
|
void |
checkOpen()
Deprecated.
Check whether the isOpen returns true, raising a BadDescriptorException if
it returns false.
|
void |
close()
Deprecated.
Close this descriptor.
|
ChannelDescriptor |
dup()
Deprecated.
Mimics the POSIX dup(2) function, returning a new descriptor that references
the same open channel.
|
ChannelDescriptor |
dup2(int fileno)
Deprecated.
Mimics the POSIX dup2(2) function, returning a new descriptor that references
the same open channel but with a specified fileno.
|
void |
dup2Into(ChannelDescriptor other)
Deprecated.
Mimics the POSIX dup2(2) function, returning a new descriptor that references
the same open channel but with a specified fileno.
|
Channel |
getChannel()
Deprecated.
The channel associated with this descriptor.
|
static ChannelDescriptor |
getDescriptorByFileno(int aFileno)
Deprecated.
|
static FileDescriptor |
getDescriptorFromChannel(Channel channel)
Deprecated.
|
FileDescriptor |
getFileDescriptor()
Deprecated.
Get the FileDescriptor object associated with this descriptor.
|
int |
getFileno()
Deprecated.
Get this descriptor's file number.
|
static int |
getFilenoFromChannel(Channel channel)
Deprecated.
|
static int |
getNewFileno()
Deprecated.
|
ModeFlags |
getOriginalModes()
Deprecated.
Get the original mode flags for the descriptor.
|
int |
internalWrite(ByteBuffer buffer)
Deprecated.
Write the bytes in the specified byte list to the associated channel.
|
boolean |
isNull()
Deprecated.
Whether the channel associated with this descriptor is a NullChannel,
for which many operations are simply noops.
|
boolean |
isOpen()
Deprecated.
Whether the channel associated with this descriptor is open.
|
boolean |
isReadable()
Deprecated.
Whether the channel associated with this descriptor is readable (i.e.
|
boolean |
isSeekable()
Deprecated.
Whether the channel associated with this descriptor is seekable (i.e.
|
boolean |
isWritable()
Deprecated.
Whether the channel associated with this descriptor is writable (i.e.
|
long |
lseek(long offset,
int whence)
Deprecated.
Perform a low-level seek operation on the associated channel if it is
instanceof FileChannel, or raise PipeException if it is not a FileChannel.
|
static ChannelDescriptor |
open(String cwd,
String path,
ModeFlags flags)
Deprecated.
|
static ChannelDescriptor |
open(String cwd,
String path,
ModeFlags flags,
ClassLoader classLoader)
Deprecated.
|
static ChannelDescriptor |
open(String cwd,
String path,
ModeFlags flags,
int perm,
jnr.posix.POSIX posix)
Deprecated.
|
static ChannelDescriptor |
open(String cwd,
String path,
ModeFlags flags,
int perm,
jnr.posix.POSIX posix,
ClassLoader classLoader)
Deprecated.
|
int |
read(ByteBuffer buffer)
Deprecated.
Perform a low-level read of the remaining number of bytes into the specified
byte buffer.
|
int |
read(int number,
org.jruby.util.ByteList byteList)
Deprecated.
Perform a low-level read of the specified number of bytes into the specified
byte list.
|
ChannelDescriptor |
reopen(Channel channel,
ModeFlags modes)
Deprecated.
|
ChannelDescriptor |
reopen(RandomAccessFile file,
ModeFlags modes)
Deprecated.
|
void |
setCanBeSeekable(boolean canBeSeekable)
Deprecated.
Set the channel to be explicitly seekable or not, for streams that appear
to be seekable with the instanceof FileChannel check.
|
int |
write(ByteBuffer buffer)
Deprecated.
Write the bytes in the specified byte list to the associated channel.
|
int |
write(org.jruby.util.ByteList buf)
Deprecated.
Write the bytes in the specified byte list to the associated channel.
|
int |
write(org.jruby.util.ByteList buf,
int offset,
int len)
Deprecated.
Write the bytes in the specified byte list to the associated channel.
|
int |
write(int c)
Deprecated.
Write the byte represented by the specified int to the associated channel.
|
public ChannelDescriptor(Channel channel, ModeFlags originalModes, FileDescriptor fileDescriptor)
channel
- The channel for the new descriptororiginalModes
- The mode flags for the new descriptorfileDescriptor
- The java.io.FileDescriptor object for the new descriptorpublic ChannelDescriptor(Channel channel, ModeFlags originalModes, FileDescriptor fileDescriptor, boolean isInAppendMode)
channel
- The channel for the new descriptororiginalModes
- The mode flags for the new descriptorfileDescriptor
- The java.io.FileDescriptor object for the new descriptorpublic ChannelDescriptor(Channel channel, ModeFlags originalModes)
channel
- The channel for the new descriptororiginalModes
- The mode flags for the new descriptorpublic ChannelDescriptor(InputStream baseInputStream, ModeFlags originalModes, FileDescriptor fileDescriptor)
baseInputStream
- The stream to create the channel for the new descriptororiginalModes
- The mode flags for the new descriptorfileDescriptor
- The java.io.FileDescriptor object for the new descriptorpublic ChannelDescriptor(InputStream baseInputStream, ModeFlags originalModes)
baseInputStream
- The stream to create the channel for the new descriptororiginalModes
- The mode flags for the new descriptorpublic ChannelDescriptor(Channel channel, FileDescriptor fileDescriptor) throws InvalidValueException
channel
- The channel for the new descriptorfileDescriptor
- The java.io.FileDescriptor object for the new descriptorInvalidValueException
@Deprecated public ChannelDescriptor(Channel channel, int fileno, FileDescriptor fileDescriptor) throws InvalidValueException
InvalidValueException
public ChannelDescriptor(Channel channel) throws InvalidValueException
channel
- The channel for the new descriptorInvalidValueException
public int getFileno()
public FileDescriptor getFileDescriptor()
public Channel getChannel()
public boolean isSeekable()
public void setCanBeSeekable(boolean canBeSeekable)
canBeSeekable
- Whether the channel is seekable or not.public boolean isNull()
public boolean isWritable()
public boolean isReadable()
public boolean isOpen()
public void checkOpen() throws BadDescriptorException
BadDescriptorException
- if isOpen returns falsepublic ModeFlags getOriginalModes()
public void checkNewModes(ModeFlags newModes) throws InvalidValueException
newModes
- The modes to confirm as supersetInvalidValueException
- if the modes are not a supersetpublic ChannelDescriptor dup()
public ChannelDescriptor dup2(int fileno)
fileno
- The fileno to use for the new descriptorpublic void dup2Into(ChannelDescriptor other) throws BadDescriptorException, IOException
other
- the descriptor to dup this one intoBadDescriptorException
IOException
public ChannelDescriptor reopen(Channel channel, ModeFlags modes)
public ChannelDescriptor reopen(RandomAccessFile file, ModeFlags modes) throws IOException
IOException
public long lseek(long offset, int whence) throws IOException, InvalidValueException, PipeException, BadDescriptorException
offset
- the offset value to usewhence
- whence to seekIOException
- If there is an exception while seekingInvalidValueException
- If the value specified for
offset or whence is invalidPipeException
- If the target channel is not seekableBadDescriptorException
- If the target channel is
already closed.public int read(int number, org.jruby.util.ByteList byteList) throws IOException, BadDescriptorException
number
- the number of bytes to readbyteList
- the byte list on which to append the incoming bytesIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closed.ByteList
public int read(ByteBuffer buffer) throws IOException, BadDescriptorException
buffer
- the java.nio.ByteBuffer in which to put the incoming bytesIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closedByteBuffer
public int internalWrite(ByteBuffer buffer) throws IOException, BadDescriptorException
buffer
- the byte list containing the bytes to be writtenIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closedpublic int write(ByteBuffer buffer) throws IOException, BadDescriptorException
buffer
- the byte list containing the bytes to be writtenIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closedpublic int write(org.jruby.util.ByteList buf) throws IOException, BadDescriptorException
buf
- the byte list containing the bytes to be writtenIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closedpublic int write(org.jruby.util.ByteList buf, int offset, int len) throws IOException, BadDescriptorException
buf
- the byte list containing the bytes to be writtenoffset
- the offset to start at. this is relative to the begin variable in the butlen
- the amount of bytes to write. this should not be longer than the bufferIOException
- if there is an exception during IOBadDescriptorException
- if the associated
channel is already closedpublic int write(int c) throws IOException, BadDescriptorException
c
- The byte to writeIOException
- If there was an exception during IOBadDescriptorException
- if the associated
channel is already closed@Deprecated public static ChannelDescriptor open(String cwd, String path, ModeFlags flags) throws FileNotFoundException, DirectoryAsFileException, FileExistsException, IOException
cwd
- the "current working directory" to use when opening the filepath
- the file path to openflags
- the mode flags to use for opening the fileFileNotFoundException
DirectoryAsFileException
FileExistsException
IOException
@Deprecated public static ChannelDescriptor open(String cwd, String path, ModeFlags flags, ClassLoader classLoader) throws FileNotFoundException, DirectoryAsFileException, FileExistsException, IOException
cwd
- the "current working directory" to use when opening the filepath
- the file path to openflags
- the mode flags to use for opening the fileclassLoader
- a ClassLoader to use for classpath: resourcesFileNotFoundException
DirectoryAsFileException
FileExistsException
IOException
@Deprecated public static ChannelDescriptor open(String cwd, String path, ModeFlags flags, int perm, jnr.posix.POSIX posix) throws FileNotFoundException, DirectoryAsFileException, FileExistsException, IOException
cwd
- the "current working directory" to use when opening the filepath
- the file path to openflags
- the mode flags to use for opening the fileperm
- the file permissions to use when creating a new file (currently
unobserved)posix
- a POSIX api implementation, used for setting permissions; if null, permissions are ignoredFileNotFoundException
DirectoryAsFileException
FileExistsException
IOException
@Deprecated public static ChannelDescriptor open(String cwd, String path, ModeFlags flags, int perm, jnr.posix.POSIX posix, ClassLoader classLoader) throws FileNotFoundException, DirectoryAsFileException, FileExistsException, IOException
cwd
- the "current working directory" to use when opening the filepath
- the file path to openflags
- the mode flags to use for opening the fileperm
- the file permissions to use when creating a new file (currently
unobserved)posix
- a POSIX api implementation, used for setting permissions; if null, permissions are ignoredclassLoader
- a ClassLoader to use for classpath: resourcesFileNotFoundException
DirectoryAsFileException
FileExistsException
IOException
public void close() throws BadDescriptorException, IOException
BadDescriptorException
- if the associated
channel is already closedIOException
- if there is an exception during IO@Deprecated public static int getNewFileno()
@Deprecated public static ChannelDescriptor getDescriptorByFileno(int aFileno)
@Deprecated public static FileDescriptor getDescriptorFromChannel(Channel channel)
@Deprecated public static int getFilenoFromChannel(Channel channel)
Copyright © 2001-2015 JRuby. All Rights Reserved.