org.jruby.util
Class IOHandler

java.lang.Object
  extended byorg.jruby.util.IOHandler
Direct Known Subclasses:
IOHandlerSeekable, IOHandlerUnseekable

public abstract class IOHandler
extends java.lang.Object


Field Summary
protected  int fileno
           
protected  boolean isOpen
           
protected  boolean isSync
           
protected  IOModes modes
           
static int SEEK_CUR
           
static int SEEK_END
           
static int SEEK_SET
           
 
Constructor Summary
protected IOHandler(Ruby ruby)
           
 
Method Summary
protected  void checkOpen()
           
 void checkPermissionsSubsetOf(IOModes subsetModes)
           
protected  void checkReadable()
           
protected  void checkWriteable()
           
abstract  IOHandler cloneIOHandler()
           
abstract  void close()
           
abstract  void flush()
           
 int getc()
           
 int getFileno()
           
abstract  java.io.InputStream getInputStream()
           
 java.lang.String getModeString()
           
abstract  java.io.OutputStream getOutputStream()
           
protected  Ruby getRuntime()
           
 java.lang.String gets(java.lang.String separatorString)
           
 java.lang.String getsEntireStream()
           
abstract  boolean isEOF()
          Return true when at end of file (EOF).
 boolean isOpen()
           
 boolean isReadable()
           
 boolean isSync()
           
 boolean isWriteable()
           
abstract  int pid()
          Get the process ID associated with this handler.
abstract  long pos()
          Get the current position within the file associated with this handler.
 void putc(int c)
           
 int read()
           
 java.lang.String read(int number)
           
 void reset(IOModes subsetModes)
           
protected abstract  void resetByModes(IOModes modes)
           
abstract  void rewind()
           
abstract  void seek(long offset, int type)
          Perform a seek based on pos().
 void setFileno(int fileno)
           
 void setIsSync(boolean isSync)
           
abstract  void sync()
          Flush and sync all writes to the filesystem.
abstract  int sysread()
           
 java.lang.String sysread(int number)
           
abstract  int syswrite(java.lang.String buf)
           
 void ungetc(int c)
           
 int write(java.lang.String string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEEK_SET

public static final int SEEK_SET
See Also:
Constant Field Values

SEEK_CUR

public static final int SEEK_CUR
See Also:
Constant Field Values

SEEK_END

public static final int SEEK_END
See Also:
Constant Field Values

modes

protected IOModes modes

fileno

protected int fileno

isOpen

protected boolean isOpen

isSync

protected boolean isSync
Constructor Detail

IOHandler

protected IOHandler(Ruby ruby)
Method Detail

getFileno

public int getFileno()

setFileno

public void setFileno(int fileno)

getRuntime

protected Ruby getRuntime()
Returns:

isReadable

public boolean isReadable()
Returns:

isOpen

public boolean isOpen()
Returns:

isWriteable

public boolean isWriteable()
Returns:

checkOpen

protected void checkOpen()

checkReadable

protected void checkReadable()

checkWriteable

protected void checkWriteable()

checkPermissionsSubsetOf

public void checkPermissionsSubsetOf(IOModes subsetModes)

getModeString

public java.lang.String getModeString()

isSync

public boolean isSync()
Returns:

setIsSync

public void setIsSync(boolean isSync)

gets

public java.lang.String gets(java.lang.String separatorString)
                      throws java.io.IOException
Throws:
java.io.IOException

getsEntireStream

public java.lang.String getsEntireStream()

read

public int read()

getc

public int getc()

read

public java.lang.String read(int number)

ungetc

public void ungetc(int c)

putc

public void putc(int c)

reset

public void reset(IOModes subsetModes)

write

public int write(java.lang.String string)

sysread

public java.lang.String sysread(int number)

cloneIOHandler

public abstract IOHandler cloneIOHandler()

close

public abstract void close()

flush

public abstract void flush()

getInputStream

public abstract java.io.InputStream getInputStream()

getOutputStream

public abstract java.io.OutputStream getOutputStream()

isEOF

public abstract boolean isEOF()

Return true when at end of file (EOF).

Returns:
true if at EOF; false otherwise

pid

public abstract int pid()

Get the process ID associated with this handler.

Returns:
the pid if the IOHandler represents a process; otherwise -1

pos

public abstract long pos()

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

Returns:
the current position in the file.
Throws:
Errno::ESPIPE - (illegal seek) when not a file

resetByModes

protected abstract void resetByModes(IOModes modes)

rewind

public abstract void rewind()

seek

public abstract void seek(long offset,
                          int type)

Perform a seek based on pos().


sync

public abstract void sync()
                   throws java.io.IOException

Flush and sync all writes to the filesystem.

Throws:
java.io.IOException - if the sync does not work

sysread

public abstract int sysread()
                     throws java.io.IOException
Throws:
java.io.IOException

syswrite

public abstract int syswrite(java.lang.String buf)


Copyright © 2002 Jan Arne Petersen. All Rights Reserved.