|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyIO
public class RubyIO
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jruby.RubyObject |
|---|
RubyObject.Data, RubyObject.ObjectMethods |
| Nested classes/interfaces inherited from class org.jruby.RubyBasicObject |
|---|
RubyBasicObject.BasicObjectMethods, RubyBasicObject.Finalizer |
| Field Summary | |
|---|---|
protected java.util.List<RubyThread> |
blockingThreads
|
protected IRubyObject |
externalEncoding
|
protected static java.util.concurrent.atomic.AtomicInteger |
filenoIndex
|
protected IRubyObject |
internalEncoding
|
protected OpenFile |
openFile
|
| Fields inherited from class org.jruby.RubyObject |
|---|
OBJECT_ALLOCATOR |
| Fields inherited from class org.jruby.RubyBasicObject |
|---|
ALL_F, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F |
| Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
|---|
NULL_ARRAY |
| Constructor Summary | |
|---|---|
RubyIO(Ruby runtime,
java.nio.channels.Channel channel)
|
|
RubyIO(Ruby runtime,
java.io.InputStream inputStream)
|
|
RubyIO(Ruby runtime,
java.io.OutputStream outputStream)
|
|
RubyIO(Ruby runtime,
RubyClass type)
|
|
RubyIO(Ruby runtime,
ShellLauncher.POpenProcess process,
ModeFlags modes)
|
|
RubyIO(Ruby runtime,
STDIO stdio)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected OpenFile openFile
protected java.util.List<RubyThread> blockingThreads
protected IRubyObject externalEncoding
protected IRubyObject internalEncoding
protected static java.util.concurrent.atomic.AtomicInteger filenoIndex
| Constructor Detail |
|---|
public RubyIO(Ruby runtime,
RubyClass type)
public RubyIO(Ruby runtime,
java.io.OutputStream outputStream)
public RubyIO(Ruby runtime,
java.io.InputStream inputStream)
public RubyIO(Ruby runtime,
java.nio.channels.Channel channel)
public RubyIO(Ruby runtime,
ShellLauncher.POpenProcess process,
ModeFlags modes)
public RubyIO(Ruby runtime,
STDIO stdio)
| Method Detail |
|---|
public void registerDescriptor(ChannelDescriptor descriptor,
boolean isRetained)
public void registerDescriptor(ChannelDescriptor descriptor)
public void unregisterDescriptor(int aFileno)
public ChannelDescriptor getDescriptorByFileno(int aFileno)
public static int getNewFileno()
public static RubyIO newIO(Ruby runtime,
java.nio.channels.Channel channel)
public OpenFile getOpenFile()
protected OpenFile getOpenFileChecked()
public int getNativeTypeIndex()
RubyObject
getNativeTypeIndex in interface CoreObjectTypegetNativeTypeIndex in class RubyObjectorg.jruby.runtime.ClassIndepublic static RubyClass createIOClass(Ruby runtime)
public java.io.OutputStream getOutStream()
public java.io.InputStream getInStream()
public java.nio.channels.Channel getChannel()
public Stream getHandler()
public IRubyObject reopen(ThreadContext context,
IRubyObject[] args)
throws InvalidValueException
InvalidValueException
public static ModeFlags getIOModes(Ruby runtime,
java.lang.String modesString)
throws InvalidValueException
InvalidValueException
public static int getIOModesIntFromString(Ruby runtime,
java.lang.String modesString)
public IRubyObject getline(Ruby runtime,
org.jruby.util.ByteList separator)
public IRubyObject getline(Ruby runtime,
org.jruby.util.ByteList separator,
long limit)
protected boolean swallow(int term)
throws java.io.IOException,
BadDescriptorException
java.io.IOException
BadDescriptorExceptionpublic static boolean restartSystemCall(java.lang.Exception e)
public IRubyObject getlineFast(Ruby runtime,
int delim)
throws java.io.IOException,
BadDescriptorException
java.io.IOException
BadDescriptorException
public static IRubyObject newInstance(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public IRubyObject initialize19(ThreadContext context,
IRubyObject fileNumber,
Block unusedBlock)
public IRubyObject initialize19(ThreadContext context,
IRubyObject fileNumber,
IRubyObject second,
Block unusedBlock)
public IRubyObject initialize19(ThreadContext context,
IRubyObject fileNumber,
IRubyObject modeValue,
IRubyObject options,
Block unusedBlock)
protected ModeFlags parseModes(IRubyObject arg)
protected ModeFlags parseModes19(ThreadContext context,
IRubyObject arg)
public IRubyObject initialize(IRubyObject[] args,
Block unusedBlock)
protected Stream fdopen(ChannelDescriptor existingDescriptor,
ModeFlags modes)
throws InvalidValueException
InvalidValueExceptionpublic IRubyObject external_encoding(ThreadContext context)
public IRubyObject internal_encoding(ThreadContext context)
public IRubyObject set_encoding(ThreadContext context,
IRubyObject encodingString)
public IRubyObject set_encoding(ThreadContext context,
IRubyObject encodingString,
IRubyObject internalEncoding)
public IRubyObject set_encoding(ThreadContext context,
IRubyObject encodingString,
IRubyObject internalEncoding,
IRubyObject options)
public static IRubyObject open(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public static IRubyObject sysopen(IRubyObject recv,
IRubyObject[] args,
Block block)
public IRubyObject binmode()
public IRubyObject op_binmode(ThreadContext context)
protected void checkInitialized()
protected void checkClosed()
public IRubyObject syswrite(ThreadContext context,
IRubyObject obj)
public IRubyObject write_nonblock(ThreadContext context,
IRubyObject obj)
public IRubyObject write(ThreadContext context,
IRubyObject obj)
protected boolean waitWritable(ChannelDescriptor descriptor)
throws java.io.IOException
java.io.IOException
protected boolean waitReadable(ChannelDescriptor descriptor)
throws java.io.IOException
java.io.IOExceptionprotected int fwrite(org.jruby.util.ByteList buffer)
public IRubyObject op_append(ThreadContext context,
IRubyObject anObject)
public RubyFixnum fileno(ThreadContext context)
public RubyFixnum lineno(ThreadContext context)
public RubyFixnum lineno_set(ThreadContext context,
IRubyObject newLineNumber)
newLineNumber - The new line number.public RubyBoolean sync(ThreadContext context)
public IRubyObject pid(ThreadContext context)
Return the process id (pid) of the process this IO object spawned. If no process exists (popen was not called), then nil is returned. This is not how it appears to be defined but ruby 1.8 works this way.
public boolean writeDataBuffered()
public RubyFixnum pos(ThreadContext context)
public RubyFixnum pos_set(ThreadContext context,
IRubyObject newPosition)
public IRubyObject print(ThreadContext context,
IRubyObject[] args)
public static IRubyObject print(ThreadContext context,
IRubyObject maybeIO,
IRubyObject[] args)
public IRubyObject printf(ThreadContext context,
IRubyObject[] args)
public IRubyObject putc(ThreadContext context,
IRubyObject object)
public static IRubyObject putc(ThreadContext context,
IRubyObject maybeIO,
IRubyObject object)
public RubyFixnum seek(ThreadContext context,
IRubyObject[] args)
public RubyFixnum seek(ThreadContext context,
IRubyObject arg0)
public RubyFixnum seek(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1)
public RubyFixnum sysseek(ThreadContext context,
IRubyObject[] args)
public RubyFixnum rewind(ThreadContext context)
public RubyFixnum fsync(ThreadContext context)
public IRubyObject sync_set(IRubyObject newSync)
newSync - The new sync mode.public RubyBoolean eof_p(ThreadContext context)
public RubyBoolean tty_p(ThreadContext context)
public IRubyObject initialize_copy(IRubyObject original)
RubyObject
initialize_copy in class RubyObjectpublic RubyBoolean closed_p(ThreadContext context)
public boolean isClosed()
public IRubyObject close()
Closes all open resources for the IO. It also removes it from our magical all open file descriptor pool.
protected IRubyObject close2(Ruby runtime)
public IRubyObject close_write(ThreadContext context)
throws BadDescriptorException
BadDescriptorException
public IRubyObject close_read(ThreadContext context)
throws BadDescriptorException
BadDescriptorExceptionpublic RubyIO flush()
@Deprecated
public IRubyObject gets(ThreadContext context,
IRubyObject[] args)
public IRubyObject gets(ThreadContext context)
public IRubyObject gets(ThreadContext context,
IRubyObject separatorArg)
public IRubyObject gets19(ThreadContext context)
public IRubyObject gets19(ThreadContext context,
IRubyObject arg)
public IRubyObject gets19(ThreadContext context,
IRubyObject separator,
IRubyObject limit_arg)
public boolean getBlocking()
public IRubyObject fcntl(ThreadContext context,
IRubyObject cmd)
public IRubyObject fcntl(ThreadContext context,
IRubyObject cmd,
IRubyObject arg)
public IRubyObject ioctl(ThreadContext context,
IRubyObject[] args)
public IRubyObject ctl(Ruby runtime,
IRubyObject cmd,
IRubyObject arg)
public IRubyObject puts(ThreadContext context,
IRubyObject[] args)
public static IRubyObject puts(ThreadContext context,
IRubyObject maybeIO,
IRubyObject[] args)
protected void write(ThreadContext context,
org.jruby.util.ByteList byteList)
protected static void write(ThreadContext context,
IRubyObject maybeIO,
org.jruby.util.ByteList byteList)
@Deprecated
public IRubyObject readline(ThreadContext context,
IRubyObject[] args)
public IRubyObject readline(ThreadContext context)
public IRubyObject readline(ThreadContext context,
IRubyObject separator)
public IRubyObject getc()
public IRubyObject ungetc(IRubyObject number)
Pushes char represented by int back onto IOS.
number - to push back
public IRubyObject read_nonblock(ThreadContext context,
IRubyObject[] args)
public IRubyObject readpartial(ThreadContext context,
IRubyObject[] args)
public IRubyObject sysread(ThreadContext context,
IRubyObject[] args)
public IRubyObject read(IRubyObject[] args)
public IRubyObject read(ThreadContext context)
public IRubyObject read(ThreadContext context,
IRubyObject arg0)
public IRubyObject read(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1)
protected IRubyObject readAll(IRubyObject buffer)
throws BadDescriptorException,
java.io.EOFException,
java.io.IOException
BadDescriptorException
java.io.EOFException
java.io.IOExceptionpublic IRubyObject readchar()
public IRubyObject stat(ThreadContext context)
public IRubyObject each_byte(ThreadContext context,
Block block)
Invoke a block for each byte.
public IRubyObject each_byte19(ThreadContext context,
Block block)
public IRubyObject bytes(ThreadContext context)
public IRubyObject lines(ThreadContext context)
public IRubyObject each_char(ThreadContext context,
Block block)
public IRubyObject each_char19(ThreadContext context,
Block block)
public IRubyObject chars19(ThreadContext context,
Block block)
public RubyIO each_line(ThreadContext context,
IRubyObject[] args,
Block block)
Invoke a block for each line.
public IRubyObject each19(ThreadContext context,
IRubyObject[] args,
Block block)
public IRubyObject each_line19(ThreadContext context,
IRubyObject[] args,
Block block)
public RubyArray readlines(ThreadContext context,
IRubyObject[] args)
public RubyIO to_io()
public java.lang.String toString()
RubyObject
toString in class RubyObject
public static IRubyObject foreach(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public static IRubyObject foreach19(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public static IRubyObject select(ThreadContext context,
IRubyObject recv,
IRubyObject[] args)
public static IRubyObject select_static(ThreadContext context,
Ruby runtime,
IRubyObject[] args)
public static IRubyObject read(ThreadContext context,
IRubyObject recv,
IRubyObject[] args)
public static IRubyObject read(ThreadContext context,
IRubyObject recv,
IRubyObject path,
Block unusedBlock)
public static IRubyObject read(ThreadContext context,
IRubyObject recv,
IRubyObject path,
IRubyObject length)
public static IRubyObject read(ThreadContext context,
IRubyObject recv,
IRubyObject path,
IRubyObject length,
IRubyObject offset)
public static IRubyObject read19(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block unusedBlock)
public static RubyArray readlines(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block unusedBlock)
public static IRubyObject popen(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public static IRubyObject popen3(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
public static IRubyObject pipe(ThreadContext context,
IRubyObject recv)
throws java.lang.Exception
java.lang.Exception
public static IRubyObject copy_stream(ThreadContext context,
IRubyObject recv,
IRubyObject arg1,
IRubyObject arg2)
throws java.io.IOException
java.io.IOExceptionpublic void addBlockingThread(RubyThread thread)
thread - A thread blocking on this IOpublic void removeBlockingThread(RubyThread thread)
thread - A thread blocking on this IOprotected void interruptBlockingThreads()
protected ModeFlags parseOptions(ThreadContext context,
IRubyObject options,
ModeFlags modes)
opt can have the following keys
:mode ::
same as mode parameter
:external_encoding ::
external encoding for the IO. "-" is a
synonym for the default external encoding.
:internal_encoding ::
internal encoding for the IO.
"-" is a synonym for the default internal encoding.
If the value is nil no conversion occurs.
:encoding ::
specifies external and internal encodings as "extern:intern".
:textmode ::
If the value is truth value, same as "b" in argument mode.
:binmode ::
If the value is truth value, same as "t" in argument mode.
Also opt can have same keys in String#encode for
controlling conversion between the external encoding and the internal encoding.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||