com.caucho.quercus.lib.file
Class FileInput

java.lang.Object
  extended by java.io.InputStream
      extended by com.caucho.quercus.lib.file.ReadStreamInput
          extended by com.caucho.quercus.lib.file.FileInput
All Implemented Interfaces:
EnvCleanup, BinaryInput, BinaryStream, LockableStream, java.io.Closeable

public class FileInput
extends ReadStreamInput
implements LockableStream, EnvCleanup

Represents a Quercus file open for reading


Field Summary
protected  Env _env
           
protected  ReadStream _is
           
protected  Path _path
           
 
Fields inherited from interface com.caucho.quercus.lib.file.BinaryStream
SEEK_CUR, SEEK_END, SEEK_SET
 
Constructor Summary
FileInput(Env env, Path path)
           
 
Method Summary
 void cleanup()
          Implements the EnvCleanup interface.
 void close()
          Closes the file.
 long getLength()
          Returns the number of bytes available to be read, 0 if not known.
 Path getPath()
          Returns the path.
 boolean lock(boolean shared, boolean block)
          Lock the shared advisory lock.
 BinaryInput openCopy()
          Opens a copy.
 long seek(long offset, int whence)
          Seek according to offset and whence.
 Value stat()
          Returns an array filled with stat information.
 java.lang.String toString()
          Converts to a string.
 boolean unlock()
          Unlock the advisory lock.
 
Methods inherited from class com.caucho.quercus.lib.file.ReadStreamInput
appendTo, closeRead, getInputStream, getPosition, getResourceType, init, isEOF, read, read, read, read, readLine, readOptionalLinefeed, setEncoding, setPosition, toJavaObject, unread, writeToStream
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_env

protected Env _env

_path

protected Path _path

_is

protected ReadStream _is
Constructor Detail

FileInput

public FileInput(Env env,
                 Path path)
          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getPath

public Path getPath()
Returns the path.


openCopy

public BinaryInput openCopy()
                     throws java.io.IOException
Opens a copy.

Specified by:
openCopy in interface BinaryInput
Overrides:
openCopy in class ReadStreamInput
Throws:
java.io.IOException

getLength

public long getLength()
Returns the number of bytes available to be read, 0 if not known.


seek

public long seek(long offset,
                 int whence)
Description copied from interface: BinaryStream
Seek according to offset and whence. For fseek() compatibility in wrapped streams.

Specified by:
seek in interface BinaryStream
Overrides:
seek in class ReadStreamInput

lock

public boolean lock(boolean shared,
                    boolean block)
Lock the shared advisory lock.

Specified by:
lock in interface LockableStream

unlock

public boolean unlock()
Unlock the advisory lock.

Specified by:
unlock in interface LockableStream

stat

public Value stat()
Description copied from interface: BinaryStream
Returns an array filled with stat information. Mainly for wrapped stream functionality.

Specified by:
stat in interface BinaryStream
Overrides:
stat in class ReadStreamInput

close

public void close()
Description copied from class: ReadStreamInput
Closes the file.

Specified by:
close in interface BinaryInput
Specified by:
close in interface BinaryStream
Specified by:
close in interface java.io.Closeable
Overrides:
close in class ReadStreamInput

cleanup

public void cleanup()
Implements the EnvCleanup interface.

Specified by:
cleanup in interface EnvCleanup

toString

public java.lang.String toString()
Converts to a string.

Overrides:
toString in class ReadStreamInput