com.caucho.quercus.lib.file
Class FileOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by com.caucho.quercus.lib.file.AbstractBinaryOutput
          extended by com.caucho.quercus.lib.file.FileOutput
All Implemented Interfaces:
EnvCleanup, BinaryOutput, BinaryStream, LockableStream, java.io.Closeable, java.io.Flushable

public class FileOutput
extends AbstractBinaryOutput
implements LockableStream, EnvCleanup

Represents a PHP open file


Field Summary
 
Fields inherited from interface com.caucho.quercus.lib.file.BinaryStream
SEEK_CUR, SEEK_END, SEEK_SET
 
Constructor Summary
FileOutput(Env env, Path path)
           
FileOutput(Env env, Path path, boolean isAppend)
           
 
Method Summary
 void cleanup()
          Implements the EnvCleanup interface.
 void close()
          Closes the file.
 void closeWrite()
          Closes the file.
 void flush()
          Flushes the output.
 java.io.OutputStream getOutputStream()
          Returns the write stream.
 Path getPath()
          Returns the file's path.
 long getPosition()
          Returns the current location in the file.
 boolean lock(boolean shared, boolean block)
          Lock the shared advisory lock.
 void print(char v)
          Prints a string to a file.
 void print(java.lang.String v)
          Prints a string to a file.
 boolean setPosition(long offset)
          Sets the current location in the stream
 Value stat()
          Returns an array filled with stat information.
 java.lang.String toString()
          Converts to a string.
 boolean unlock()
          Unlock the advisory lock.
 void write(byte[] buffer, int offset, int length)
          Writes a buffer to a file.
 void write(int ch)
          Writes a character
 
Methods inherited from class com.caucho.quercus.lib.file.AbstractBinaryOutput
getResourceType, isEOF, seek, write
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileOutput

public FileOutput(Env env,
                  Path path)
           throws java.io.IOException
Throws:
java.io.IOException

FileOutput

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

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the write stream.

Specified by:
getOutputStream in interface BinaryOutput
Overrides:
getOutputStream in class AbstractBinaryOutput

getPath

public Path getPath()
Returns the file's path.


print

public void print(char v)
           throws java.io.IOException
Prints a string to a file.

Specified by:
print in interface BinaryOutput
Overrides:
print in class AbstractBinaryOutput
Throws:
java.io.IOException

print

public void print(java.lang.String v)
           throws java.io.IOException
Prints a string to a file.

Specified by:
print in interface BinaryOutput
Overrides:
print in class AbstractBinaryOutput
Throws:
java.io.IOException

write

public void write(int ch)
           throws java.io.IOException
Writes a character

Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a buffer to a file.

Specified by:
write in interface BinaryOutput
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the output.

Specified by:
flush in interface BinaryOutput
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class AbstractBinaryOutput
Throws:
java.io.IOException

closeWrite

public void closeWrite()
Closes the file.

Specified by:
closeWrite in interface BinaryOutput
Overrides:
closeWrite in class AbstractBinaryOutput

close

public void close()
Closes the file.

Specified by:
close in interface BinaryOutput
Specified by:
close in interface BinaryStream
Specified by:
close in interface java.io.Closeable
Overrides:
close in class AbstractBinaryOutput

cleanup

public void cleanup()
Implements the EnvCleanup interface.

Specified by:
cleanup in interface EnvCleanup

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 AbstractBinaryOutput

getPosition

public long getPosition()
Returns the current location in the file.

Specified by:
getPosition in interface BinaryStream
Overrides:
getPosition in class AbstractBinaryOutput

setPosition

public boolean setPosition(long offset)
Sets the current location in the stream

Specified by:
setPosition in interface BinaryStream
Overrides:
setPosition in class AbstractBinaryOutput

toString

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

Overrides:
toString in class java.lang.Object
Parameters:
env -