com.caucho.quercus.env
Class StringValue

java.lang.Object
  extended by com.caucho.quercus.env.Value
      extended by com.caucho.quercus.env.StringValue
All Implemented Interfaces:
ByteAppendable, java.io.Serializable, java.lang.CharSequence
Direct Known Subclasses:
BinaryValue, LargeStringBuilderValue, UnicodeValue

public abstract class StringValue
extends Value
implements java.lang.CharSequence, ByteAppendable

Represents a Quercus string value.

See Also:
Serialized Form

Field Summary
static StringValue EMPTY
           
protected static int IS_DOUBLE
           
protected static int IS_LONG
           
protected static int IS_STRING
           
protected static int MIN_LENGTH
           
 
Fields inherited from class com.caucho.quercus.env.Value
L, NULL_ARGS, NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
StringValue()
           
 
Method Summary
 Value add(long rValue)
          Adds to the following value.
 StringValue append(boolean v)
          Append a Java boolean to the value.
 StringValue append(byte[] buf)
          Append a byte buffer to the value.
 StringValue append(byte[] buf, int offset, int length)
          Append a byte buffer to the value.
 StringValue append(char v)
          Append a Java char to the value.
 StringValue append(char[] buf)
          Append a Java double to the value.
 StringValue append(char[] buf, int offset, int length)
          Append a Java buffer to the value.
 StringValue append(java.lang.CharSequence buf, int head, int tail)
          Append a Java buffer to the value.
 StringValue append(double v)
          Append a Java double to the value.
 StringValue append(Env env, StringValue unicodeStr, java.lang.String charset)
           
 StringValue append(long v)
          Append a Java long to the value.
 StringValue append(java.lang.Object v)
          Append a Java value to the value.
 StringValue append(java.io.Reader reader)
          Append from a read stream
 StringValue append(java.io.Reader reader, long length)
          Append from a read stream
 StringValue append(java.lang.String s)
          Append a Java string to the value.
 StringValue append(StringBuilderValue sb, int head, int tail)
          Append a Java buffer to the value.
 StringValue append(java.lang.String s, int start, int end)
          Append a Java string to the value.
 StringValue append(TempBuffer ptr)
          Append from a temp buffer list
 StringValue append(UnicodeBuilderValue sb, int head, int tail)
          Append a Java buffer to the value.
 StringValue append(Value v)
          Append a Java value to the value.
 Value append(Value index, Value value)
          Sets the array value, returning the new array, e.g.
 StringValue appendByte(int v)
          Append a Java byte to the value without conversions.
 StringValue appendBytes(byte[] bytes, int offset, int end)
          Append Java bytes to the value without conversions.
 StringValue appendBytes(char[] buf, int offset, int length)
          Append a Java char[] to the value without conversions.
 StringValue appendBytes(java.lang.String s)
          Append a Java String to the value without conversions.
 StringValue appendBytes(StringValue s)
          Append a Java String to the value without conversions.
 int appendRead(BinaryInput is, long length)
          Append from an input stream, using InputStream semantics, i.e call is.read() only once.
 int appendRead(java.io.InputStream is, long length)
          Append from an input stream, using InputStream.read semantics, i.e.
 int appendReadAll(BinaryInput is, long length)
          Append from an input stream, reading all available data from the stream.
 int appendReadAll(java.io.InputStream is, long length)
          Append from an input stream, reading from the input stream until end of file or the length is reached.
 int appendReadAll(ReadStream is, long length)
          Append from an input stream, reading from the input stream until end of file or the length is reached.
 StringValue appendTo(UnicodeBuilderValue sb)
          Append to a string builder.
 StringValue appendUnicode(boolean v)
          Append a Java boolean to the value.
 StringValue appendUnicode(char v)
          Append a Java char, possibly converting to a unicode string
 StringValue appendUnicode(char[] buffer)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUnicode(char[] buffer, int offset, int length)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUnicode(double v)
          Append a Java double to the value.
 StringValue appendUnicode(long v)
          Append a Java long to the value.
 StringValue appendUnicode(java.lang.Object v)
          Append a Java value to the value.
 StringValue appendUnicode(java.lang.String value)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUnicode(java.lang.String value, int offset, int length)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUnicode(Value value)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUnicode(Value v1, Value v2)
          Append a Java char buffer, possibly converting to a unicode string
 StringValue appendUtf8(byte[] buf)
          Append a byte buffer to the value.
 StringValue appendUtf8(byte[] buf, int offset, int length)
          Append a byte buffer to the value.
 Value bitAnd(Value rValue)
           
 Value bitOr(Value rValue)
           
 Value bitXor(Value rValue)
          Binary xor.
 char charAt(int index)
          Returns the character at a particular location
 Value charValueAt(long index)
          Returns the character at an index
 int cmp(Value rValue)
          Returns true for equality
 int cmpString(StringValue rValue)
          Compare two strings
 StringValue convertToUnicode(Env env, java.lang.String charset)
          Decodes from charset and returns UnicodeValue.
static StringValue create(char value)
          Creates the string.
 StringValue create(Env env, StringValue unicodeStr, java.lang.String charset)
           
static Value create(java.lang.Object value)
          Creates the string.
static Value create(java.lang.String value)
          Creates the string.
abstract  StringValue createStringBuilder()
          Creates a string builder of the same type.
abstract  StringValue createStringBuilder(int length)
          Creates a string builder of the same type.
 boolean endsWith(StringValue tail)
          Returns true if the string ends with another string.
 void ensureAppendCapacity(int size)
          Ensure enough append capacity.
 boolean eq(Value rValue)
          Returns true for equality
 boolean equals(java.lang.Object o)
          Test for equality
 boolean equalsIgnoreCase(java.lang.Object o)
          Test for equality
 void generate(java.io.PrintWriter out)
          Generates code to recreate the expression.
 Value get(Value key)
          Returns the character at an index
 Value getArg(Value key, boolean isTop)
          Returns the character at an index
 void getChars(int stringOffset, char[] buffer, int offset, int length)
          Copies the chars
 long getCrc32Value()
          Calculates CRC32 value.
 char[] getRawCharArray()
           
 java.lang.String getType()
          Returns the type.
 ValueType getValueType()
          Returns the ValueType.
 int hashCode()
          Returns the hash code.
 int hashCodeCaseInsensitive()
          Returns the case-insensitive hash code
 Value increment(int incr)
          Increment the following value.
 int indexOf(char match)
          Returns the last index of the match string, starting from the head.
 int indexOf(char match, int head)
          Returns the last index of the match string, starting from the head.
 int indexOf(java.lang.CharSequence match)
          Returns the first index of the match string, starting from the head.
 int indexOf(java.lang.CharSequence match, int head)
          Returns the first index of the match string, starting from the head.
 boolean isDoubleConvertible()
          Returns true for a double
 boolean isEmpty()
          Returns true if the value is empty
 boolean isLongConvertible()
          Returns true for a long
 boolean isNumber()
          Returns true for a number
 boolean isNumeric()
          Returns true for is_numeric
 boolean isPHP5String()
           
 boolean isScalar()
          Returns true for a scalar
 boolean isset(Value indexV)
          Return true if the array value is set
 boolean isString()
          Returns true for StringValue
 void jsonEncode(Env env, StringValue sb)
          Encodes the value in JSON.
 int lastIndexOf(char match)
          Returns the last index of the match string, starting from the head.
 int lastIndexOf(char match, int tail)
          Returns the last index of the match string, starting from the head.
 int lastIndexOf(java.lang.CharSequence match)
          Returns the last index of the match string, starting from the tail.
 int lastIndexOf(java.lang.CharSequence match, int tail)
          Returns the last index of the match string, starting from the tail.
 int length()
          Returns the length of the string.
 boolean regionMatches(int offset, char[] mBuffer, int mOffset, int mLength)
          Returns true if the region matches
 boolean regionMatches(int offset, StringValue match, int mOffset, int mLength)
          Returns true if the region matches
 boolean regionMatchesIgnoreCase(int offset, char[] match, int mOffset, int mLength)
          Returns true if the region matches
 void serialize(Env env, java.lang.StringBuilder sb)
          Serializes the value.
 Value setCharValueAt(long index, Value value)
          sets the character at an index
 java.lang.String stringSubstring(int begin, int end)
          Returns a String substring
 Value sub(long rValue)
          Adds to the following value.
 java.lang.CharSequence subSequence(int start, int end)
          Returns a subsequence
 StringValue substring(int head)
          Returns a StringValue substring.
 StringValue substring(int begin, int end)
          Returns a StringValue substring.
 Value toAutoArray()
          Converts to an array if null.
 Value toAutoObject(Env env)
          Converts to an object.
 int toBinaryValueMarshalCost()
          Cost to convert to a binary value
 boolean toBoolean()
          Converts to a boolean.
 int toByteMarshalCost()
          Cost to convert to a byte
 byte[] toBytes()
           
 Callable toCallable(Env env)
          Converts to a callable object
 char[] toCharArray()
          Returns a character array
 int toCharArrayMarshalCost()
          Cost to convert to a char[]
 int toCharMarshalCost()
          Cost to convert to a character
abstract  java.lang.String toDebugString()
           
 double toDouble()
          Converts to a double.
static double toDouble(java.lang.String s)
          Converts to a double.
 int toDoubleMarshalCost()
          Cost to convert to a double
 int toFloatMarshalCost()
          Cost to convert to a float
 java.io.InputStream toInputStream()
          Returns a byteArrayInputStream for the value.
 java.io.InputStream toInputStream(java.lang.String charset)
          Returns a byte stream of chars.
 int toIntegerMarshalCost()
          Cost to convert to an integer
 java.lang.Object toJavaObject()
          Converts to a Java object.
 Value toKey()
          Converts to a key.
static long toLong(java.lang.String string)
          Converts to a long.
 int toLongMarshalCost()
          Cost to convert to a long
 StringValue toLowerCase()
          Convert to lower case.
 java.io.Reader toReader(java.lang.String charset)
          Returns a char stream.
 int toShortMarshalCost()
          Cost to convert to a short
 java.io.Reader toSimpleReader()
           
 StringValue toStringBuilder(Env env)
          Converts to a string builder
 int toStringMarshalCost()
          Cost to convert to a String
 StringValue toStringValue()
          Converts to a string value.
 StringValue toStringValue(Env env)
          Converts to a string value.
 int toStringValueMarshalCost()
          Cost to convert to a StringValue
 StringValue toUnicode(Env env)
          Converts to a unicode value.
 StringValue toUnicodeValue(Env env, java.lang.String charset)
          Decodes from charset and returns UnicodeValue.
 StringValue toUpperCase()
          Convert to lower case.
 java.lang.Object valuesToArray(Env env, java.lang.Class elementType)
          Takes the values of this array, unmarshalls them to objects of type elementType, and puts them in a java array.
abstract  void varDumpImpl(Env env, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet)
           
 void varExport(java.lang.StringBuilder sb)
          Exports the value.
 void write(byte[] buffer, int offset, int len)
          Appends buffer to the ByteAppendable.
 void write(int value)
          Appends value to the ByteAppendable.
 void writeTo(java.io.OutputStream os)
          Writes to a stream
 
Methods inherited from class com.caucho.quercus.env.Value
abs, add, addOne, appendTo, appendTo, appendTo, 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, checkPrivate, checkProtected, clone, containsKey, copy, copy, copy, copyArrayItem, copyReturn, copySaveFunArg, copyStringBuilder, copyTree, current, div, div, end, eql, eqValue, findFunction, geq, 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, getValueArray, getValueIterator, getVar, gt, hasCurrent, initField, isA, isA, isArray, isBinary, isBoolean, isCallable, isDefault, isDouble, isFieldInit, isLong, isNull, isNumberConvertible, isObject, isResource, isset, issetField, issetThisField, isUnicode, isVar, key, keyExists, leq, lshift, lt, mod, mul, mul, neg, next, nextIndex, pop, pos, postdecr, postincr, postincr, predecr, preincr, preincr, prev, print, print, printDepth, printJavaChar, printJavaString, printR, printRImpl, put, put, put, putField, putField, putField, putObject, putThisField, putThisField, putVar, remove, reset, rshift, serialize, set, setFieldInit, setJavaObject, shuffle, sub_rev, sub, subOne, toArgRef, toArray, toArrayValue, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBooleanMarshalCost, toByteArrayMarshalCost, toChar, toDoubleValue, toException, toInt, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaCollection, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaList, toJavaLong, toJavaMap, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toLocalRef, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLong, toLongValue, toObject, toRef, toRefValue, toString, toStringBuilder, toStringBuilder, toStringBuilder, toUnicodeValue, toUnicodeValue, toUnicodeValueMarshalCost, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, varDump
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.CharSequence
toString
 

Field Detail

EMPTY

public static final StringValue EMPTY

MIN_LENGTH

protected static final int MIN_LENGTH
See Also:
Constant Field Values

IS_STRING

protected static final int IS_STRING
See Also:
Constant Field Values

IS_LONG

protected static final int IS_LONG
See Also:
Constant Field Values

IS_DOUBLE

protected static final int IS_DOUBLE
See Also:
Constant Field Values
Constructor Detail

StringValue

public StringValue()
Method Detail

createStringBuilder

public abstract StringValue createStringBuilder()
Creates a string builder of the same type.


createStringBuilder

public abstract StringValue createStringBuilder(int length)
Creates a string builder of the same type.


create

public static Value create(java.lang.String value)
Creates the string.


create

public static StringValue create(char value)
Creates the string.


create

public static Value create(java.lang.Object value)
Creates the string.


create

public StringValue create(Env env,
                          StringValue unicodeStr,
                          java.lang.String charset)

getType

public java.lang.String getType()
Returns the type.

Overrides:
getType in class Value

getValueType

public ValueType getValueType()
Returns the ValueType.

Overrides:
getValueType in class Value

isLongConvertible

public boolean isLongConvertible()
Returns true for a long

Overrides:
isLongConvertible in class Value

isDoubleConvertible

public boolean isDoubleConvertible()
Returns true for a double

Overrides:
isDoubleConvertible in class Value

isNumber

public boolean isNumber()
Returns true for a number


isNumeric

public boolean isNumeric()
Returns true for is_numeric

Overrides:
isNumeric in class Value

isScalar

public boolean isScalar()
Returns true for a scalar


isString

public boolean isString()
Returns true for StringValue

Overrides:
isString in class Value

isPHP5String

public boolean isPHP5String()

isEmpty

public boolean isEmpty()
Returns true if the value is empty

Overrides:
isEmpty in class Value

toDoubleMarshalCost

public int toDoubleMarshalCost()
Cost to convert to a double

Overrides:
toDoubleMarshalCost in class Value

toFloatMarshalCost

public int toFloatMarshalCost()
Cost to convert to a float

Overrides:
toFloatMarshalCost in class Value

toLongMarshalCost

public int toLongMarshalCost()
Cost to convert to a long

Overrides:
toLongMarshalCost in class Value

toIntegerMarshalCost

public int toIntegerMarshalCost()
Cost to convert to an integer

Overrides:
toIntegerMarshalCost in class Value

toShortMarshalCost

public int toShortMarshalCost()
Cost to convert to a short

Overrides:
toShortMarshalCost in class Value

toByteMarshalCost

public int toByteMarshalCost()
Cost to convert to a byte

Overrides:
toByteMarshalCost in class Value

toCharMarshalCost

public int toCharMarshalCost()
Cost to convert to a character

Overrides:
toCharMarshalCost in class Value

toStringMarshalCost

public int toStringMarshalCost()
Cost to convert to a String

Overrides:
toStringMarshalCost in class Value

toCharArrayMarshalCost

public int toCharArrayMarshalCost()
Cost to convert to a char[]

Overrides:
toCharArrayMarshalCost in class Value

toStringValueMarshalCost

public int toStringValueMarshalCost()
Cost to convert to a StringValue

Overrides:
toStringValueMarshalCost in class Value

toBinaryValueMarshalCost

public int toBinaryValueMarshalCost()
Cost to convert to a binary value

Overrides:
toBinaryValueMarshalCost in class Value

cmp

public int cmp(Value rValue)
Returns true for equality

Overrides:
cmp in class Value

eq

public boolean eq(Value rValue)
Returns true for equality

Overrides:
eq in class Value

cmpString

public int cmpString(StringValue rValue)
Compare two strings


toStringValue

public StringValue toStringValue()
Converts to a string value.

Overrides:
toStringValue in class Value

toStringValue

public StringValue toStringValue(Env env)
Converts to a string value.

Overrides:
toStringValue in class Value

toLong

public static long toLong(java.lang.String string)
Converts to a long.


toDouble

public double toDouble()
Converts to a double.

Overrides:
toDouble in class Value

toDouble

public static double toDouble(java.lang.String s)
Converts to a double.


toBoolean

public boolean toBoolean()
Converts to a boolean.

Overrides:
toBoolean in class Value

toKey

public Value toKey()
Converts to a key.

Overrides:
toKey in class Value

toAutoObject

public final Value toAutoObject(Env env)
Converts to an object.

Overrides:
toAutoObject in class Value

toAutoArray

public Value toAutoArray()
Converts to an array if null.

Overrides:
toAutoArray in class Value

toJavaObject

public java.lang.Object toJavaObject()
Converts to a Java object.

Overrides:
toJavaObject in class Value

valuesToArray

public java.lang.Object valuesToArray(Env env,
                                      java.lang.Class elementType)
Takes the values of this array, unmarshalls them to objects of type elementType, and puts them in a java array.

Overrides:
valuesToArray in class Value

toCallable

public Callable toCallable(Env env)
Converts to a callable object

Overrides:
toCallable in class Value

append

public Value append(Value index,
                    Value value)
Sets the array value, returning the new array, e.g. to handle string update ($a[0] = 'A'). Creates an array automatically if necessary.

Overrides:
append in class Value

get

public Value get(Value key)
Returns the character at an index

Overrides:
get in class Value

getArg

public Value getArg(Value key,
                    boolean isTop)
Returns the character at an index

Overrides:
getArg in class Value

charValueAt

public Value charValueAt(long index)
Returns the character at an index

Overrides:
charValueAt in class Value

setCharValueAt

public Value setCharValueAt(long index,
                            Value value)
sets the character at an index

Overrides:
setCharValueAt in class Value

increment

public Value increment(int incr)
Increment the following value.

Overrides:
increment in class Value

add

public Value add(long rValue)
Adds to the following value.

Overrides:
add in class Value

sub

public Value sub(long rValue)
Adds to the following value.

Overrides:
sub in class Value

bitAnd

public Value bitAnd(Value rValue)
Overrides:
bitAnd in class Value

bitOr

public Value bitOr(Value rValue)
Overrides:
bitOr in class Value

bitXor

public Value bitXor(Value rValue)
Description copied from class: Value
Binary xor.

Overrides:
bitXor in class Value

serialize

public void serialize(Env env,
                      java.lang.StringBuilder sb)
Serializes the value.

Overrides:
serialize in class Value

jsonEncode

public void jsonEncode(Env env,
                       StringValue sb)
Encodes the value in JSON.

Overrides:
jsonEncode in class Value

append

public StringValue append(java.lang.String s)
Append a Java string to the value.


append

public StringValue append(java.lang.String s,
                          int start,
                          int end)
Append a Java string to the value.


append

public StringValue append(char[] buf,
                          int offset,
                          int length)
Append a Java buffer to the value.


append

public StringValue append(char[] buf)
Append a Java double to the value.


append

public StringValue append(java.lang.CharSequence buf,
                          int head,
                          int tail)
Append a Java buffer to the value.


append

public StringValue append(StringBuilderValue sb,
                          int head,
                          int tail)
Append a Java buffer to the value.


append

public StringValue append(UnicodeBuilderValue sb,
                          int head,
                          int tail)
Append a Java buffer to the value.


append

public StringValue append(Env env,
                          StringValue unicodeStr,
                          java.lang.String charset)

append

public StringValue append(char v)
Append a Java char to the value.


append

public StringValue append(boolean v)
Append a Java boolean to the value.


append

public StringValue append(long v)
Append a Java long to the value.


append

public StringValue append(double v)
Append a Java double to the value.


append

public StringValue append(java.lang.Object v)
Append a Java value to the value.


append

public StringValue append(Value v)
Append a Java value to the value.


ensureAppendCapacity

public void ensureAppendCapacity(int size)
Ensure enough append capacity.


append

public StringValue append(byte[] buf,
                          int offset,
                          int length)
Append a byte buffer to the value.


append

public StringValue append(byte[] buf)
Append a byte buffer to the value.


appendUtf8

public StringValue appendUtf8(byte[] buf,
                              int offset,
                              int length)
Append a byte buffer to the value.


appendUtf8

public StringValue appendUtf8(byte[] buf)
Append a byte buffer to the value.


appendTo

public StringValue appendTo(UnicodeBuilderValue sb)
Append to a string builder.

Overrides:
appendTo in class Value

appendUnicode

public StringValue appendUnicode(boolean v)
Append a Java boolean to the value.


appendUnicode

public StringValue appendUnicode(long v)
Append a Java long to the value.


appendUnicode

public StringValue appendUnicode(double v)
Append a Java double to the value.


appendUnicode

public StringValue appendUnicode(java.lang.Object v)
Append a Java value to the value.


appendUnicode

public StringValue appendUnicode(char v)
Append a Java char, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(char[] buffer,
                                 int offset,
                                 int length)
Append a Java char buffer, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(char[] buffer)
Append a Java char buffer, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(java.lang.String value)
Append a Java char buffer, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(java.lang.String value,
                                 int offset,
                                 int length)
Append a Java char buffer, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(Value value)
Append a Java char buffer, possibly converting to a unicode string


appendUnicode

public StringValue appendUnicode(Value v1,
                                 Value v2)
Append a Java char buffer, possibly converting to a unicode string


appendByte

public StringValue appendByte(int v)
Append a Java byte to the value without conversions.


appendBytes

public StringValue appendBytes(java.lang.String s)
Append a Java String to the value without conversions.


appendBytes

public StringValue appendBytes(StringValue s)
Append a Java String to the value without conversions.


appendBytes

public StringValue appendBytes(char[] buf,
                               int offset,
                               int length)
Append a Java char[] to the value without conversions.


appendBytes

public StringValue appendBytes(byte[] bytes,
                               int offset,
                               int end)
Append Java bytes to the value without conversions.


append

public StringValue append(TempBuffer ptr)
Append from a temp buffer list


append

public StringValue append(java.io.Reader reader)
                   throws java.io.IOException
Append from a read stream

Throws:
java.io.IOException

append

public StringValue append(java.io.Reader reader,
                          long length)
                   throws java.io.IOException
Append from a read stream

Throws:
java.io.IOException

appendRead

public int appendRead(java.io.InputStream is,
                      long length)
Append from an input stream, using InputStream.read semantics, i.e. just call is.read once even if more data is available.


appendReadAll

public int appendReadAll(java.io.InputStream is,
                         long length)
Append from an input stream, reading from the input stream until end of file or the length is reached.


appendReadAll

public int appendReadAll(ReadStream is,
                         long length)
Append from an input stream, reading from the input stream until end of file or the length is reached.


appendRead

public int appendRead(BinaryInput is,
                      long length)
Append from an input stream, using InputStream semantics, i.e call is.read() only once.


appendReadAll

public int appendReadAll(BinaryInput is,
                         long length)
Append from an input stream, reading all available data from the stream.


varExport

public void varExport(java.lang.StringBuilder sb)
Exports the value.

Overrides:
varExport in class Value

length

public int length()
Returns the length of the string.

Specified by:
length in interface java.lang.CharSequence
Overrides:
length in class Value

charAt

public char charAt(int index)
Returns the character at a particular location

Specified by:
charAt in interface java.lang.CharSequence

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Returns a subsequence

Specified by:
subSequence in interface java.lang.CharSequence

indexOf

public final int indexOf(java.lang.CharSequence match)
Returns the first index of the match string, starting from the head.


indexOf

public int indexOf(java.lang.CharSequence match,
                   int head)
Returns the first index of the match string, starting from the head.


indexOf

public int indexOf(char match)
Returns the last index of the match string, starting from the head.


indexOf

public int indexOf(char match,
                   int head)
Returns the last index of the match string, starting from the head.


lastIndexOf

public final int lastIndexOf(char match)
Returns the last index of the match string, starting from the head.


lastIndexOf

public int lastIndexOf(char match,
                       int tail)
Returns the last index of the match string, starting from the head.


lastIndexOf

public int lastIndexOf(java.lang.CharSequence match)
Returns the last index of the match string, starting from the tail.


lastIndexOf

public int lastIndexOf(java.lang.CharSequence match,
                       int tail)
Returns the last index of the match string, starting from the tail.


regionMatches

public boolean regionMatches(int offset,
                             char[] mBuffer,
                             int mOffset,
                             int mLength)
Returns true if the region matches


regionMatches

public boolean regionMatches(int offset,
                             StringValue match,
                             int mOffset,
                             int mLength)
Returns true if the region matches


regionMatchesIgnoreCase

public boolean regionMatchesIgnoreCase(int offset,
                                       char[] match,
                                       int mOffset,
                                       int mLength)
Returns true if the region matches


endsWith

public boolean endsWith(StringValue tail)
Returns true if the string ends with another string.


substring

public StringValue substring(int head)
Returns a StringValue substring.


substring

public StringValue substring(int begin,
                             int end)
Returns a StringValue substring.


stringSubstring

public java.lang.String stringSubstring(int begin,
                                        int end)
Returns a String substring


toCharArray

public char[] toCharArray()
Returns a character array


getRawCharArray

public char[] getRawCharArray()

getChars

public void getChars(int stringOffset,
                     char[] buffer,
                     int offset,
                     int length)
Copies the chars


toLowerCase

public StringValue toLowerCase()
Convert to lower case.


toUpperCase

public StringValue toUpperCase()
Convert to lower case.


toInputStream

public java.io.InputStream toInputStream()
Returns a byteArrayInputStream for the value. See TempBufferStringValue for how this can be overriden

Overrides:
toInputStream in class Value
Returns:
InputStream

toInputStream

public java.io.InputStream toInputStream(java.lang.String charset)
                                  throws java.io.UnsupportedEncodingException
Returns a byte stream of chars.

Parameters:
charset - to encode chars to
Throws:
java.io.UnsupportedEncodingException

toSimpleReader

public java.io.Reader toSimpleReader()
                              throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

toReader

public java.io.Reader toReader(java.lang.String charset)
                        throws java.io.UnsupportedEncodingException
Returns a char stream. XXX: when decoding fails

Parameters:
charset - to decode bytes by
Throws:
java.io.UnsupportedEncodingException

toBytes

public byte[] toBytes()

toUnicode

public StringValue toUnicode(Env env)
Converts to a unicode value.

Overrides:
toUnicode in class Value

toUnicodeValue

public StringValue toUnicodeValue(Env env,
                                  java.lang.String charset)
Decodes from charset and returns UnicodeValue.

Parameters:
env -
charset -

convertToUnicode

public StringValue convertToUnicode(Env env,
                                    java.lang.String charset)
Decodes from charset and returns UnicodeValue.

Parameters:
env -
charset -

toStringBuilder

public StringValue toStringBuilder(Env env)
Converts to a string builder

Overrides:
toStringBuilder in class Value

isset

public boolean isset(Value indexV)
Return true if the array value is set

Overrides:
isset in class Value

writeTo

public void writeTo(java.io.OutputStream os)
Writes to a stream


getCrc32Value

public long getCrc32Value()
Calculates CRC32 value.


write

public void write(int value)
Description copied from interface: ByteAppendable
Appends value to the ByteAppendable.

Specified by:
write in interface ByteAppendable

write

public void write(byte[] buffer,
                  int offset,
                  int len)
Appends buffer to the ByteAppendable.

Specified by:
write in interface ByteAppendable

hashCode

public int hashCode()
Returns the hash code.

Overrides:
hashCode in class Value

hashCodeCaseInsensitive

public int hashCodeCaseInsensitive()
Returns the case-insensitive hash code


equals

public boolean equals(java.lang.Object o)
Test for equality

Overrides:
equals in class java.lang.Object

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.Object o)
Test for equality


generate

public void generate(java.io.PrintWriter out)
              throws java.io.IOException
Generates code to recreate the expression.

Overrides:
generate in class Value
Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

toDebugString

public abstract java.lang.String toDebugString()
Overrides:
toDebugString in class Value

varDumpImpl

public abstract void varDumpImpl(Env env,
                                 WriteStream out,
                                 int depth,
                                 java.util.IdentityHashMap<Value,java.lang.String> valueSet)
                          throws java.io.IOException
Overrides:
varDumpImpl in class Value
Throws:
java.io.IOException