com.caucho.quercus.resources
Class StreamReadWrite

java.lang.Object
  extended by com.caucho.quercus.env.Value
      extended by com.caucho.quercus.env.ResourceValue
          extended by com.caucho.quercus.resources.StreamResource
              extended by com.caucho.quercus.resources.StreamReadWrite
All Implemented Interfaces:
EnvCleanup, java.io.Serializable

public class StreamReadWrite
extends StreamResource
implements EnvCleanup

Represents read/write stream

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.caucho.quercus.env.Value
L, NULL_ARGS, NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
StreamReadWrite(Env env)
           
StreamReadWrite(Env env, ReadStream is, WriteStream os)
           
 
Method Summary
 void cleanup()
          Implements the EnvCleanup interface.
 void close()
          Closes the stream.
 void closeRead()
          Closes the stream for reading.
 void closeWrite()
          Closes the stream for writing
 void flush()
          Flushes the output
 long getPosition()
          Returns the current location in the file.
protected  void init(ReadStream is, WriteStream os)
           
 boolean isEOF()
          Returns true on the end of file.
 void print(char ch)
          prints
 void print(java.lang.String s)
          prints
 int read()
          Reads the next byte, returning -1 on eof.
 int read(byte[] buffer, int offset, int length)
          Reads a buffer, returning -1 on eof.
 int readLine(char[] buffer)
          Reads a line from the stream into a buffer.
 StringValue readLine(Env env)
          Reads a line from the buffer.
 boolean readOptionalLinefeed()
          Reads the optional linefeed character from a \r\n
 int write(byte[] buffer, int offset, int length)
          Writes to a buffer.
 
Methods inherited from class com.caucho.quercus.env.ResourceValue
printRImpl, toKey, toString, varDumpImpl
 
Methods inherited from class com.caucho.quercus.env.Value
abs, add, add, addOne, append, appendTo, appendTo, appendTo, appendTo, bitAnd, bitOr, bitXor, call, call, call, call, call, call, call, callCopy, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callRef, callRef, callRef, callRef, callRef, callRef, callRef, charValueAt, checkPrivate, checkProtected, clone, cmp, containsKey, copy, copy, copy, copyArrayItem, copyReturn, copySaveFunArg, copyStringBuilder, copyTree, current, div, div, end, eq, eql, eqValue, findFunction, generate, geq, get, getArg, getArray, getArray, getBaseIterator, getCallableName, getCalledClass, getClassName, getCount, getCountRecursive, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldVar, getHashCode, getIterator, getKeyArray, getKeyIterator, getObject, getObject, getQuercusClass, getRef, getResourceType, getSize, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldVar, getType, getValueArray, getValueIterator, getValueType, getVar, gt, hasCurrent, hashCode, increment, initField, isA, isA, isArray, isBinary, isBoolean, isCallable, isDefault, isDouble, isDoubleConvertible, isEmpty, isFieldInit, isLong, isLongConvertible, isNull, isNumberConvertible, isNumeric, isObject, isResource, isset, isset, issetField, issetThisField, isString, isUnicode, isVar, jsonEncode, key, keyExists, length, leq, lshift, lt, mod, mul, mul, neg, next, nextIndex, pop, pos, postdecr, postincr, postincr, predecr, preincr, preincr, prev, print, print, printDepth, printJavaChar, printJavaString, printR, put, put, put, putField, putField, putField, putObject, putThisField, putThisField, putVar, remove, reset, rshift, serialize, serialize, set, setCharValueAt, setFieldInit, setJavaObject, shuffle, sub_rev, sub, sub, subOne, toArgRef, toArray, toArrayValue, toAutoArray, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBinaryValueMarshalCost, toBoolean, toBooleanMarshalCost, toByteArrayMarshalCost, toByteMarshalCost, toCallable, toChar, toCharArrayMarshalCost, toCharMarshalCost, toDebugString, toDouble, toDoubleMarshalCost, toDoubleValue, toException, toFloatMarshalCost, toInputStream, toInt, toIntegerMarshalCost, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaCollection, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaList, toJavaLong, toJavaMap, toJavaObject, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toLocalRef, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLong, toLongMarshalCost, toLongValue, toObject, toRef, toRefValue, toShortMarshalCost, toString, toStringBuilder, toStringBuilder, toStringBuilder, toStringBuilder, toStringMarshalCost, toStringValue, toStringValue, toStringValueMarshalCost, toUnicode, toUnicodeValue, toUnicodeValue, toUnicodeValueMarshalCost, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, valuesToArray, varDump, varExport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamReadWrite

public StreamReadWrite(Env env)

StreamReadWrite

public StreamReadWrite(Env env,
                       ReadStream is,
                       WriteStream os)
Method Detail

init

protected void init(ReadStream is,
                    WriteStream os)

read

public int read()
         throws java.io.IOException
Reads the next byte, returning -1 on eof.

Overrides:
read in class StreamResource
Throws:
java.io.IOException

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Reads a buffer, returning -1 on eof.

Overrides:
read in class StreamResource
Throws:
java.io.IOException

readOptionalLinefeed

public boolean readOptionalLinefeed()
                             throws java.io.IOException
Reads the optional linefeed character from a \r\n

Overrides:
readOptionalLinefeed in class StreamResource
Throws:
java.io.IOException

readLine

public StringValue readLine(Env env)
                     throws java.io.IOException
Reads a line from the buffer.

Overrides:
readLine in class StreamResource
Throws:
java.io.IOException

readLine

public int readLine(char[] buffer)
Reads a line from the stream into a buffer.


write

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

Overrides:
write in class StreamResource
Throws:
java.io.IOException

print

public void print(char ch)
           throws java.io.IOException
prints

Overrides:
print in class StreamResource
Throws:
java.io.IOException

print

public void print(java.lang.String s)
           throws java.io.IOException
prints

Overrides:
print in class StreamResource
Throws:
java.io.IOException

isEOF

public boolean isEOF()
Returns true on the end of file.

Overrides:
isEOF in class StreamResource

flush

public void flush()
Flushes the output

Overrides:
flush in class StreamResource

getPosition

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

Overrides:
getPosition in class StreamResource

closeRead

public void closeRead()
Closes the stream for reading.

Overrides:
closeRead in class StreamResource

closeWrite

public void closeWrite()
Closes the stream for writing

Overrides:
closeWrite in class StreamResource

close

public void close()
Closes the stream.

Overrides:
close in class StreamResource

cleanup

public void cleanup()
Implements the EnvCleanup interface.

Specified by:
cleanup in interface EnvCleanup
Overrides:
cleanup in class ResourceValue