|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.util.io.ChannelStream
public class ChannelStream
This file implements a seekable IO file.
Field Summary | |
---|---|
protected java.nio.ByteBuffer |
buffer
|
protected ModeFlags |
modes
|
protected boolean |
reading
|
protected boolean |
sync
|
protected int |
ungotc
|
Fields inherited from interface org.jruby.util.io.Stream |
---|
PARAGRAPH_DELIMETER, PARAGRAPH_SEPARATOR, SEEK_CUR, SEEK_END, SEEK_SET |
Constructor Summary | |
---|---|
ChannelStream(Ruby runtime,
ChannelDescriptor descriptor)
|
|
ChannelStream(Ruby runtime,
ChannelDescriptor descriptor,
java.io.FileDescriptor fileDescriptor)
|
|
ChannelStream(Ruby runtime,
ChannelDescriptor descriptor,
ModeFlags modes)
|
|
ChannelStream(Ruby runtime,
ChannelDescriptor descriptor,
ModeFlags modes,
java.io.FileDescriptor fileDescriptor)
|
Method Summary | |
---|---|
void |
checkPermissionsSubsetOf(ModeFlags subsetModes)
|
void |
checkReadable()
|
void |
checkWritable()
|
void |
clearerr()
|
void |
fclose()
Close IO handler resources. |
static Stream |
fdopen(Ruby runtime,
ChannelDescriptor descriptor,
ModeFlags modes)
|
boolean |
feof()
Return true when at end of file (EOF). |
int |
fflush()
|
int |
fgetc()
|
long |
fgetpos()
Get the current position within the file associated with this handler. |
ByteList |
fgets(ByteList separatorString)
|
void |
finalize()
Ensure close (especially flush) when we're finished with |
static Stream |
fopen(Ruby runtime,
java.lang.String path,
ModeFlags modes)
|
void |
fputc(int c)
|
ByteList |
fread(int number)
|
void |
freopen(java.lang.String path,
ModeFlags modes)
|
void |
ftruncate(long newLength)
|
int |
fwrite(ByteList string)
|
ChannelDescriptor |
getDescriptor()
|
int |
getline(ByteList dst,
byte terminator)
An version of read that reads all bytes up to and including a terminator byte. |
ModeFlags |
getModes()
|
Ruby |
getRuntime()
|
boolean |
isBlocking()
|
boolean |
isSync()
|
void |
lseek(long offset,
int type)
Implementation of libc "lseek", which seeks on seekable streams, raises EPIPE if the fd is assocated with a pipe, socket, or FIFO, and doesn't do anything for other cases (like stdio). |
java.io.InputStream |
newInputStream()
|
java.io.OutputStream |
newOutputStream()
|
int |
read()
|
ByteList |
read(int number)
|
ByteList |
readall()
|
boolean |
readDataBuffered()
|
ByteList |
readnonblock(int number)
|
ByteList |
readpartial(int number)
|
int |
ready()
Implement IO#ready? as per io/wait in MRI. |
void |
setBlocking(boolean block)
|
void |
setSync(boolean sync)
|
void |
sync()
Flush and sync all writes to the filesystem. |
int |
ungetc(int c)
|
void |
waitUntilReady()
Implement IO#wait as per io/wait in MRI. |
boolean |
writeDataBuffered()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ModeFlags modes
protected boolean sync
protected volatile java.nio.ByteBuffer buffer
protected boolean reading
protected int ungotc
Constructor Detail |
---|
public ChannelStream(Ruby runtime, ChannelDescriptor descriptor, ModeFlags modes, java.io.FileDescriptor fileDescriptor) throws InvalidValueException
InvalidValueException
public ChannelStream(Ruby runtime, ChannelDescriptor descriptor)
public ChannelStream(Ruby runtime, ChannelDescriptor descriptor, java.io.FileDescriptor fileDescriptor)
public ChannelStream(Ruby runtime, ChannelDescriptor descriptor, ModeFlags modes) throws InvalidValueException
InvalidValueException
Method Detail |
---|
public Ruby getRuntime()
public void checkReadable() throws java.io.IOException
java.io.IOException
public void checkWritable() throws java.io.IOException
java.io.IOException
public void checkPermissionsSubsetOf(ModeFlags subsetModes)
public ModeFlags getModes()
getModes
in interface Stream
public boolean isSync()
isSync
in interface Stream
public void setSync(boolean sync)
setSync
in interface Stream
public void waitUntilReady() throws java.io.IOException, java.lang.InterruptedException
waitUntilReady
in interface Stream
java.io.IOException
java.lang.InterruptedException
public boolean readDataBuffered()
readDataBuffered
in interface Stream
public boolean writeDataBuffered()
writeDataBuffered
in interface Stream
public ByteList fgets(ByteList separatorString) throws java.io.IOException, BadDescriptorException
fgets
in interface Stream
java.io.IOException
BadDescriptorException
public int getline(ByteList dst, byte terminator) throws java.io.IOException, BadDescriptorException
If the terminator byte is found, it will be the last byte in the output buffer.
getline
in interface Stream
dst
- The output buffer.terminator
- The byte to terminate reading.
java.io.IOException
BadDescriptorException
public ByteList readall() throws java.io.IOException, BadDescriptorException
readall
in interface Stream
java.io.IOException
BadDescriptorException
public void fclose() throws java.io.IOException, BadDescriptorException
Close IO handler resources.
fclose
in interface Stream
java.io.IOException
BadDescriptorException
org.jruby.util.IOHandler#close()
public int fflush() throws java.io.IOException, BadDescriptorException
fflush
in interface Stream
java.io.IOException
BadDescriptorException
org.jruby.util.IOHandler#flush()
public java.io.InputStream newInputStream()
newInputStream
in interface Stream
org.jruby.util.IOHandler#getInputStream()
public java.io.OutputStream newOutputStream()
newOutputStream
in interface Stream
org.jruby.util.IOHandler#getOutputStream()
public void clearerr()
clearerr
in interface Stream
public boolean feof() throws java.io.IOException, BadDescriptorException
Stream
Return true when at end of file (EOF).
feof
in interface Stream
java.io.IOException
BadDescriptorException
org.jruby.util.IOHandler#isEOF()
public long fgetpos() throws java.io.IOException, PipeException, InvalidValueException, BadDescriptorException
Stream
Get the current position within the file associated with this handler.
fgetpos
in interface Stream
java.io.IOException
PipeException
- ESPIPE (illegal seek) when not a file
InvalidValueException
BadDescriptorException
org.jruby.util.IOHandler#pos()
public void lseek(long offset, int type) throws java.io.IOException, InvalidValueException, PipeException, BadDescriptorException
lseek
in interface Stream
java.io.IOException
InvalidValueException
PipeException
BadDescriptorException
org.jruby.util.IOHandler#seek(long, int)
public void sync() throws java.io.IOException, BadDescriptorException
Stream
Flush and sync all writes to the filesystem.
sync
in interface Stream
java.io.IOException
- if the sync does not work
BadDescriptorException
org.jruby.util.IOHandler#sync()
public ByteList read(int number) throws java.io.IOException, BadDescriptorException
read
in interface Stream
java.io.IOException
BadDescriptorException
public void ftruncate(long newLength) throws java.io.IOException, BadDescriptorException, InvalidValueException
ftruncate
in interface Stream
java.io.IOException
BadDescriptorException
InvalidValueException
public void finalize()
finalize
in interface Finalizable
finalize
in class java.lang.Object
public int ready() throws java.io.IOException
Stream
ready
in interface Stream
java.io.IOException
public void fputc(int c) throws java.io.IOException, BadDescriptorException
fputc
in interface Stream
java.io.IOException
BadDescriptorException
public int ungetc(int c)
ungetc
in interface Stream
public int fgetc() throws java.io.IOException, BadDescriptorException
fgetc
in interface Stream
java.io.IOException
BadDescriptorException
public int fwrite(ByteList string) throws java.io.IOException, BadDescriptorException
fwrite
in interface Stream
java.io.IOException
BadDescriptorException
public ByteList fread(int number) throws java.io.IOException, BadDescriptorException
fread
in interface Stream
java.io.IOException
BadDescriptorException
public ByteList readnonblock(int number) throws java.io.IOException, BadDescriptorException, java.io.EOFException
java.io.IOException
BadDescriptorException
java.io.EOFException
public ByteList readpartial(int number) throws java.io.IOException, BadDescriptorException, java.io.EOFException
java.io.IOException
BadDescriptorException
java.io.EOFException
public int read() throws java.io.IOException, BadDescriptorException
java.io.IOException
BadDescriptorException
public ChannelDescriptor getDescriptor()
getDescriptor
in interface Stream
public void setBlocking(boolean block) throws java.io.IOException
setBlocking
in interface Stream
java.io.IOException
public boolean isBlocking()
isBlocking
in interface Stream
public void freopen(java.lang.String path, ModeFlags modes) throws DirectoryAsFileException, java.io.IOException, InvalidValueException, PipeException, BadDescriptorException
freopen
in interface Stream
DirectoryAsFileException
java.io.IOException
InvalidValueException
PipeException
BadDescriptorException
public static Stream fopen(Ruby runtime, java.lang.String path, ModeFlags modes) throws java.io.FileNotFoundException, DirectoryAsFileException, FileExistsException, java.io.IOException, InvalidValueException, PipeException, BadDescriptorException
java.io.FileNotFoundException
DirectoryAsFileException
FileExistsException
java.io.IOException
InvalidValueException
PipeException
BadDescriptorException
public static Stream fdopen(Ruby runtime, ChannelDescriptor descriptor, ModeFlags modes) throws InvalidValueException
InvalidValueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |