com.caucho.quercus.lib.file
Class WriteStreamOutput

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

public class WriteStreamOutput
extends java.io.OutputStream
implements BinaryOutput

Represents a Quercus file open for reading


Field Summary
 
Fields inherited from interface com.caucho.quercus.lib.file.BinaryStream
SEEK_CUR, SEEK_END, SEEK_SET
 
Constructor Summary
WriteStreamOutput(java.io.OutputStream os)
           
 
Method Summary
 void close()
          Closes the stream.
 void closeWrite()
          Closes the stream for writing
 java.io.OutputStream getOutputStream()
          Returns the input stream.
 long getPosition()
          Tells the position in the stream.
 java.lang.String getResourceType()
           
 boolean isEOF()
          Returns true if end-of-file has been reached
 void print(char ch)
          prints a unicode character
 void print(java.lang.String s)
          prints
 long seek(long offset, int whence)
          Seek according to offset and whence.
 boolean setPosition(long offset)
          Sets the current position in the stream.
 Value stat()
          Returns an array filled with stat information.
 java.lang.Object toJavaObject()
           
 java.lang.String toString()
          Converts to a string.
 void write(byte[] buffer, int offset, int length)
          Writes a buffer.
 int write(java.io.InputStream is, int length)
          Writes a buffer.
 void write(int ch)
           
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.quercus.lib.file.BinaryOutput
flush
 

Constructor Detail

WriteStreamOutput

public WriteStreamOutput(java.io.OutputStream os)
Method Detail

getOutputStream

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

Specified by:
getOutputStream in interface BinaryOutput

close

public void close()
Description copied from interface: BinaryOutput
Closes the stream.

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

toJavaObject

public java.lang.Object toJavaObject()

getResourceType

public java.lang.String getResourceType()

write

public void write(int ch)
           throws java.io.IOException
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
Description copied from interface: BinaryOutput
Writes a buffer.

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

closeWrite

public void closeWrite()
Description copied from interface: BinaryOutput
Closes the stream for writing

Specified by:
closeWrite in interface BinaryOutput

print

public void print(char ch)
           throws java.io.IOException
Description copied from interface: BinaryOutput
prints a unicode character

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

print

public void print(java.lang.String s)
           throws java.io.IOException
Description copied from interface: BinaryOutput
prints

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

write

public int write(java.io.InputStream is,
                 int length)
          throws java.io.IOException
Description copied from interface: BinaryOutput
Writes a buffer.

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

getPosition

public long getPosition()
Description copied from interface: BinaryStream
Tells the position in the stream. The valid range for a stream position is 0 to Long.MAX_VALUE, so a negative number can't be a valid stream position.

Specified by:
getPosition in interface BinaryStream

isEOF

public boolean isEOF()
Description copied from interface: BinaryStream
Returns true if end-of-file has been reached

Specified by:
isEOF in interface BinaryStream

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

setPosition

public boolean setPosition(long offset)
Description copied from interface: BinaryStream
Sets the current position in the stream. Returns true on success, false otherwise.

Specified by:
setPosition in interface BinaryStream

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

toString

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

Overrides:
toString in class java.lang.Object