com.caucho.quercus.env
Class UnicodeBuilderValue

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

public class UnicodeBuilderValue
extends UnicodeValue

Represents a PHP string value.

See Also:
Serialized Form

Field Summary
protected  boolean _isCopy
           
static UnicodeBuilderValue EMPTY
           
 
Fields inherited from class com.caucho.quercus.env.StringValue
IS_DOUBLE, IS_LONG, IS_STRING, MIN_LENGTH
 
Fields inherited from class com.caucho.quercus.env.Value
L, NULL_ARGS, NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
UnicodeBuilderValue()
           
UnicodeBuilderValue(char ch)
           
UnicodeBuilderValue(char[] buffer)
           
UnicodeBuilderValue(char[] buffer, int length)
           
UnicodeBuilderValue(char[] buffer, int offset, int length)
           
UnicodeBuilderValue(char[] s, Value v1)
           
UnicodeBuilderValue(java.lang.Character[] buffer)
           
UnicodeBuilderValue(int capacity)
           
UnicodeBuilderValue(java.lang.String s)
           
UnicodeBuilderValue(StringBuilderValue v, boolean isCopy)
           
UnicodeBuilderValue(UnicodeBuilderValue v)
           
UnicodeBuilderValue(Value v1)
           
 
Method Summary
 StringValue append(byte[] buf, int offset, int length)
          Append a 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(Env env, StringValue unicodeStr, java.lang.String charset)
           
 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(java.lang.String s, int start, int end)
          Append a Java string to the value.
 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 ref.
 StringValue appendByte(int v)
          Append a Java byte to the value without conversions.
 StringValue appendTo(UnicodeBuilderValue sb)
          Append to a string builder.
 char charAt(int index)
          Returns the character at a particular location
 Value charValueAt(long index)
          Returns the character at an index
 StringValue convertToUnicode(Env env, java.lang.String charset)
          Decodes from charset and returns UnicodeValue.
 StringValue copyStringBuilder()
          Converts to a string builder
static StringValue create(char value)
          Creates the string.
 StringValue create(Env env, StringValue str, java.lang.String charset)
          Decodes the Unicode str from charset.
static Value create(java.lang.String value)
          Creates a PHP string from a Java String.
 StringValue createStringBuilder()
          Creates a string builder of the same type.
 StringValue createStringBuilder(int length)
          Creates a string builder of the same type.
 void ensureAppendCapacity(int newCapacity)
          Ensure enough append capacity.
protected  void ensureCapacity(int newCapacity)
           
 boolean eq(Value rValue)
          Returns true for equality
 boolean eql(Value o)
          Returns true for equality
 boolean equals(java.lang.Object o)
          Test for equality
 Value get(Value key)
          Returns the character at an index
 char[] getBuffer()
          Returns the buffer.
 int getLength()
          Returns the current capacity.
static int getNumericType(char[] buffer, int offset, int len)
           
 int getOffset()
          Returns the offset.
 char[] getRawCharArray()
          Return the underlying buffer.
 java.lang.String getType()
          Returns the type.
 java.lang.String getValue()
          Returns the value.
 ValueType getValueType()
          Returns the ValueType.
static ValueType getValueType(char[] buffer, int offset, int len)
           
 int hashCode()
          Returns the hash code.
 boolean isEmpty()
          Returns true if the value is empty.
 boolean isUnicode()
          Returns true for UnicodeValue
 int length()
          Returns the length of the string.
 void print(Env env)
          Prints the value.
 Value put(Value index, Value value)
          Sets the array ref.
 void serialize(Env env, java.lang.StringBuilder sb)
          Serializes the value.
 Value setCharValueAt(long indexL, Value value)
          sets the character at an index
 void setOffset(int offset)
          Sets the offset.
 java.lang.CharSequence subSequence(int start, int end)
          Returns a subsequence
 StringValue toBinaryValue()
          Converts to a BinaryValue.
 StringValue toBinaryValue(Env env)
          Converts to a BinaryValue.
 StringValue toBinaryValue(java.lang.String charset)
          Converts to a BinaryValue in desired charset.
 boolean toBoolean()
          Converts to a boolean.
 byte[] toBytes()
          Converts to a byte array, with no consideration of character encoding.
 char[] toCharArray()
          Returns a character array
 double toDouble()
          Converts to a double.
static double toDouble(char[] buffer, int offset, int len)
           
 Value toKey()
          Converts to a key.
 long toLong()
          Converts to a long.
static long toLong(char[] buffer, int offset, int len)
          Converts to a long.
 StringValue toLowerCase()
          Convert to lower case.
 java.lang.String toString()
           
 StringValue toStringBuilder()
          Converts to a string builder
 StringValue toStringBuilder(Env env)
          Converts to a string builder
 StringValue toStringBuilder(Env env, Value value)
          Converts to a string builder
 StringValue toUnicodeValue()
          Converts to a UnicodeValue.
 StringValue toUnicodeValue(Env env)
          Converts to a UnicodeValue.
 StringValue toUnicodeValue(Env env, java.lang.String charset)
          Converts to a UnicodeValue in desired charset.
 StringValue toUpperCase()
          Convert to lower case.
 
Methods inherited from class com.caucho.quercus.env.UnicodeValue
toDebugString, toUnicodeValueMarshalCost, varDumpImpl
 
Methods inherited from class com.caucho.quercus.env.StringValue
add, append, append, append, append, append, append, append, append, appendBytes, appendBytes, appendBytes, appendBytes, appendRead, appendRead, appendReadAll, appendReadAll, appendReadAll, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUnicode, appendUtf8, appendUtf8, bitAnd, bitOr, bitXor, cmp, cmpString, create, endsWith, equalsIgnoreCase, generate, getArg, getChars, getCrc32Value, hashCodeCaseInsensitive, increment, indexOf, indexOf, indexOf, indexOf, isDoubleConvertible, isLongConvertible, isNumber, isNumeric, isPHP5String, isScalar, isset, isString, jsonEncode, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, regionMatches, regionMatches, regionMatchesIgnoreCase, stringSubstring, sub, substring, substring, toAutoArray, toAutoObject, toBinaryValueMarshalCost, toByteMarshalCost, toCallable, toCharArrayMarshalCost, toCharMarshalCost, toDouble, toDoubleMarshalCost, toFloatMarshalCost, toInputStream, toInputStream, toIntegerMarshalCost, toJavaObject, toLong, toLongMarshalCost, toReader, toShortMarshalCost, toSimpleReader, toStringMarshalCost, toStringValue, toStringValue, toStringValueMarshalCost, toUnicode, valuesToArray, varExport, write, write, writeTo
 
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, copyTree, current, div, div, end, 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, isVar, key, keyExists, leq, lshift, lt, mod, mul, mul, neg, next, nextIndex, pop, pos, postdecr, postincr, postincr, predecr, preincr, preincr, prev, print, printDepth, printJavaChar, printJavaString, printR, printRImpl, 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, 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, toLongValue, toObject, toRef, toRefValue, toString, toStringBuilder, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, varDump
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final UnicodeBuilderValue EMPTY

_isCopy

protected boolean _isCopy
Constructor Detail

UnicodeBuilderValue

public UnicodeBuilderValue()

UnicodeBuilderValue

public UnicodeBuilderValue(int capacity)

UnicodeBuilderValue

public UnicodeBuilderValue(java.lang.String s)

UnicodeBuilderValue

public UnicodeBuilderValue(char[] buffer,
                           int offset,
                           int length)

UnicodeBuilderValue

public UnicodeBuilderValue(char[] buffer)

UnicodeBuilderValue

public UnicodeBuilderValue(char[] buffer,
                           int length)

UnicodeBuilderValue

public UnicodeBuilderValue(java.lang.Character[] buffer)

UnicodeBuilderValue

public UnicodeBuilderValue(char ch)

UnicodeBuilderValue

public UnicodeBuilderValue(char[] s,
                           Value v1)

UnicodeBuilderValue

public UnicodeBuilderValue(Value v1)

UnicodeBuilderValue

public UnicodeBuilderValue(UnicodeBuilderValue v)

UnicodeBuilderValue

public UnicodeBuilderValue(StringBuilderValue v,
                           boolean isCopy)
Method Detail

create

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


create

public static Value create(java.lang.String value)
Creates a PHP string from a Java String. If the value is null then NullValue is returned.


create

public StringValue create(Env env,
                          StringValue str,
                          java.lang.String charset)
Decodes the Unicode str from charset.

Overrides:
create in class StringValue
Parameters:
str - should be a Unicode string
charset - to decode string from

convertToUnicode

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

Overrides:
convertToUnicode in class StringValue
Parameters:
env -
charset -

isUnicode

public final boolean isUnicode()
Returns true for UnicodeValue

Overrides:
isUnicode in class UnicodeValue

getValue

public final java.lang.String getValue()
Returns the value.


getType

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

Overrides:
getType in class StringValue

getValueType

public ValueType getValueType()
Returns the ValueType.

Overrides:
getValueType in class StringValue

toStringBuilder

public StringValue toStringBuilder()
Converts to a string builder

Overrides:
toStringBuilder in class UnicodeValue

toStringBuilder

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

Overrides:
toStringBuilder in class StringValue

toStringBuilder

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

Overrides:
toStringBuilder in class Value

copyStringBuilder

public StringValue copyStringBuilder()
Converts to a string builder

Overrides:
copyStringBuilder in class Value

toUnicodeValue

public final StringValue toUnicodeValue()
Converts to a UnicodeValue.

Overrides:
toUnicodeValue in class UnicodeValue

toUnicodeValue

public final StringValue toUnicodeValue(Env env)
Converts to a UnicodeValue.

Overrides:
toUnicodeValue in class UnicodeValue

toUnicodeValue

public final StringValue toUnicodeValue(Env env,
                                        java.lang.String charset)
Converts to a UnicodeValue in desired charset.

Overrides:
toUnicodeValue in class UnicodeValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

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

Overrides:
append in class StringValue

append

public StringValue append(Env env,
                          StringValue unicodeStr,
                          java.lang.String charset)
Overrides:
append in class StringValue

appendTo

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

Overrides:
appendTo in class StringValue

append

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

Overrides:
append in class StringValue
Throws:
java.io.IOException

appendByte

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

Overrides:
appendByte in class StringValue

isEmpty

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

Overrides:
isEmpty in class StringValue

toKey

public Value toKey()
Converts to a key.

Overrides:
toKey in class StringValue

toBytes

public final byte[] toBytes()
Converts to a byte array, with no consideration of character encoding. Each character becomes one byte, characters with values above 255 are not correctly preserved.

Overrides:
toBytes in class StringValue

get

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

Overrides:
get in class StringValue

put

public Value put(Value index,
                 Value value)
Sets the array ref.

Overrides:
put in class Value

append

public Value append(Value index,
                    Value value)
Sets the array ref.

Overrides:
append in class StringValue

getBuffer

public final char[] getBuffer()
Returns the buffer.


getOffset

public int getOffset()
Returns the offset.


setOffset

public void setOffset(int offset)
Sets the offset.


getLength

public int getLength()
Returns the current capacity.


toBinaryValue

public StringValue toBinaryValue()
Converts to a BinaryValue.

Overrides:
toBinaryValue in class Value

toBinaryValue

public StringValue toBinaryValue(Env env)
Converts to a BinaryValue.

Overrides:
toBinaryValue in class Value

toBinaryValue

public StringValue toBinaryValue(java.lang.String charset)
Converts to a BinaryValue in desired charset.

Overrides:
toBinaryValue in class Value
Parameters:
env -
charset -

charValueAt

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

Overrides:
charValueAt in class StringValue

setCharValueAt

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

Overrides:
setCharValueAt in class StringValue

length

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

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

charAt

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

Specified by:
charAt in interface java.lang.CharSequence
Overrides:
charAt in class StringValue

subSequence

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

Specified by:
subSequence in interface java.lang.CharSequence
Overrides:
subSequence in class StringValue

toLowerCase

public StringValue toLowerCase()
Convert to lower case.

Overrides:
toLowerCase in class StringValue

toUpperCase

public StringValue toUpperCase()
Convert to lower case.

Overrides:
toUpperCase in class StringValue

toCharArray

public char[] toCharArray()
Returns a character array

Overrides:
toCharArray in class StringValue

getRawCharArray

public char[] getRawCharArray()
Return the underlying buffer.

Overrides:
getRawCharArray in class StringValue

print

public void print(Env env)
Prints the value.

Overrides:
print in class Value
Parameters:
env -

serialize

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

Overrides:
serialize in class StringValue

createStringBuilder

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

Specified by:
createStringBuilder in class StringValue

createStringBuilder

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

Specified by:
createStringBuilder in class StringValue

getNumericType

public static int getNumericType(char[] buffer,
                                 int offset,
                                 int len)

getValueType

public static ValueType getValueType(char[] buffer,
                                     int offset,
                                     int len)

toBoolean

public final boolean toBoolean()
Converts to a boolean.

Overrides:
toBoolean in class StringValue

toLong

public long toLong()
Converts to a long.

Overrides:
toLong in class Value

toLong

public static long toLong(char[] buffer,
                          int offset,
                          int len)
Converts to a long.


toDouble

public double toDouble()
Converts to a double.

Overrides:
toDouble in class StringValue

toDouble

public static double toDouble(char[] buffer,
                              int offset,
                              int len)

ensureAppendCapacity

public void ensureAppendCapacity(int newCapacity)
Description copied from class: StringValue
Ensure enough append capacity.

Overrides:
ensureAppendCapacity in class StringValue

ensureCapacity

protected void ensureCapacity(int newCapacity)

hashCode

public int hashCode()
Returns the hash code.

Overrides:
hashCode in class StringValue

eq

public boolean eq(Value rValue)
Returns true for equality

Overrides:
eq in class StringValue

equals

public boolean equals(java.lang.Object o)
Description copied from class: StringValue
Test for equality

Overrides:
equals in class StringValue

eql

public boolean eql(Value o)
Description copied from class: Value
Returns true for equality

Overrides:
eql in class Value

toString

public java.lang.String toString()
Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class java.lang.Object