org.jruby.util
Class IOHandlerProcess

java.lang.Object
  extended by org.jruby.util.IOHandler
      extended by org.jruby.util.IOHandlerJavaIO
          extended by org.jruby.util.IOHandlerProcess

public class IOHandlerProcess
extends IOHandlerJavaIO


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jruby.util.IOHandler
IOHandler.BadDescriptorException, IOHandler.InvalidValueException, IOHandler.PipeException
 
Field Summary
protected  java.io.InputStream input
           
protected  java.io.OutputStream output
           
protected  java.lang.Process process
           
 
Fields inherited from class org.jruby.util.IOHandlerJavaIO
ungotc
 
Fields inherited from class org.jruby.util.IOHandler
fileno, isOpen, isSync, modes, PARAGRAPH_DELIMETER, SEEK_CUR, SEEK_END, SEEK_SET
 
Constructor Summary
IOHandlerProcess(Ruby runtime, java.lang.Process process, IOModes modes)
           
 
Method Summary
 IOHandler cloneIOHandler()
           
 void close()
          Close IO handler resources.
 void flush()
           
 java.nio.channels.FileChannel getFileChannel()
           
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
           
 boolean isEOF()
          Return true when at end of file (EOF).
 int pid()
          Get the process ID associated with this handler.
 long pos()
          Get the current position within the file associated with this handler.
 void resetByModes(IOModes newModes)
           
 void rewind()
           
 void seek(long offset, int type)
          Perform a seek based on pos().
 void sync()
          Flush and sync all writes to the filesystem.
 int sysread()
           
 ByteList sysread(int number)
           
 int syswrite(ByteList buf)
           
 int syswrite(int c)
           
 void truncate(long newLength)
           
 
Methods inherited from class org.jruby.util.IOHandlerJavaIO
getc, gets, getsEntireStream, putc, read, read, ready, sysread, ungetc, write
 
Methods inherited from class org.jruby.util.IOHandler
checkOpen, checkPermissionsSubsetOf, checkReadable, checkWritable, checkWriteable, getFileno, getModes, getRuntime, hasPendingBuffered, isOpen, isReadable, isSync, isWriteable, reset, setFileno, setIsSync, waitUntilReady
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

protected java.io.InputStream input

output

protected java.io.OutputStream output

process

protected java.lang.Process process
Constructor Detail

IOHandlerProcess

public IOHandlerProcess(Ruby runtime,
                        java.lang.Process process,
                        IOModes modes)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

cloneIOHandler

public IOHandler cloneIOHandler()
                         throws java.io.IOException
Specified by:
cloneIOHandler in class IOHandler
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException,
                  IOHandler.BadDescriptorException

Close IO handler resources.

Specified by:
close in class IOHandler
Throws:
java.io.IOException
BadDescriptorException
IOHandler.BadDescriptorException
See Also:
IOHandler.close()

flush

public void flush()
           throws java.io.IOException,
                  IOHandler.BadDescriptorException
Specified by:
flush in class IOHandler
Throws:
java.io.IOException
BadDescriptorException
IOHandler.BadDescriptorException
See Also:
IOHandler.flush()

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in class IOHandlerJavaIO
See Also:
org.jruby.util.IOHandler#getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream()
Specified by:
getOutputStream in class IOHandlerJavaIO
See Also:
org.jruby.util.IOHandler#getOutputStream()

isEOF

public boolean isEOF()
              throws java.io.IOException,
                     IOHandler.BadDescriptorException
Description copied from class: IOHandler

Return true when at end of file (EOF).

Specified by:
isEOF in class IOHandler
Returns:
true if at EOF; false otherwise
Throws:
java.io.IOException
BadDescriptorException
IOHandler.BadDescriptorException
See Also:
IOHandler.isEOF()

pid

public int pid()
Description copied from class: IOHandler

Get the process ID associated with this handler.

Specified by:
pid in class IOHandler
Returns:
the pid if the IOHandler represents a process; otherwise -1
See Also:
IOHandler.pid()

pos

public long pos()
         throws IOHandler.PipeException
Description copied from class: IOHandler

Get the current position within the file associated with this handler.

Specified by:
pos in class IOHandler
Returns:
the current position in the file.
Throws:
PipeException
IOHandler.PipeException
See Also:
IOHandler.pos()

resetByModes

public void resetByModes(IOModes newModes)
Specified by:
resetByModes in class IOHandler

rewind

public void rewind()
            throws IOHandler.PipeException
Specified by:
rewind in class IOHandler
Throws:
PipeException
IOHandler.PipeException
See Also:
IOHandler.rewind()

seek

public void seek(long offset,
                 int type)
          throws IOHandler.PipeException
Description copied from class: IOHandler

Perform a seek based on pos().

Specified by:
seek in class IOHandler
Throws:
PipeException
IOHandler.PipeException
See Also:
IOHandler.seek(long, int)

sync

public void sync()
          throws java.io.IOException
Description copied from class: IOHandler

Flush and sync all writes to the filesystem.

Specified by:
sync in class IOHandler
Throws:
java.io.IOException - if the sync does not work
See Also:
IOHandler.sync()

sysread

public int sysread()
            throws java.io.IOException
Specified by:
sysread in class IOHandlerJavaIO
Throws:
java.io.IOException
See Also:
org.jruby.util.IOHandler#sysread()

sysread

public ByteList sysread(int number)
                 throws java.io.IOException,
                        IOHandler.BadDescriptorException
Overrides:
sysread in class IOHandlerJavaIO
Throws:
java.io.IOException
IOHandler.BadDescriptorException

syswrite

public int syswrite(ByteList buf)
             throws java.io.IOException,
                    IOHandler.BadDescriptorException
Specified by:
syswrite in class IOHandler
Throws:
java.io.IOException
BadDescriptorException
IOHandler.BadDescriptorException
See Also:
org.jruby.util.IOHandler#syswrite(String buf)

syswrite

public int syswrite(int c)
             throws java.io.IOException,
                    IOHandler.BadDescriptorException
Specified by:
syswrite in class IOHandler
Throws:
java.io.IOException
BadDescriptorException
IOHandler.BadDescriptorException
See Also:
org.jruby.util.IOHandler#syswrite(String buf)

truncate

public void truncate(long newLength)
              throws java.io.IOException,
                     IOHandler.PipeException
Specified by:
truncate in class IOHandler
Throws:
java.io.IOException
IOHandler.PipeException

getFileChannel

public java.nio.channels.FileChannel getFileChannel()
Specified by:
getFileChannel in class IOHandler


Copyright © 2002-2007 JRuby Team. All Rights Reserved.