tcl.lang
Class TclString

java.lang.Object
  extended by tcl.lang.TclString
All Implemented Interfaces:
InternalRep

public class TclString
extends Object
implements InternalRep


Method Summary
static void append(TclObject tobj, char[] charArr, int offset, int length)
          Appends an array of characters to a TclObject Object.
static void append(TclObject tobj, String string)
          Appends a string to a TclObject object.
static void append(TclObject tobj, TclObject tobj2)
          Appends a TclObject to a TclObject.
static void append(TclObject tobj, TclObject[] objv, int startIdx, int endIdx)
          Appends the String values of multiple TclObject's to a TclObject.
 void dispose()
          Implement this no-op for the InternalRep interface.
 InternalRep duplicate()
          Returns a dupilcate of the current object.
static void empty(TclObject tobj)
          This procedure clears out an existing TclObject so that it has a string representation of "".
 StringBuffer getSbuf()
          Return the internal StringBuffer.
static TclObject newInstance(char c)
          Create a TclObject with an internal TclString representation whose initial value is a string with the single character.
static TclObject newInstance(Object o)
           
static TclObject newInstance(String str)
          Create a new TclObject that has a string representation with the given string value.
static TclObject newInstance(StringBuffer sb)
          Create a new TclObject that makes use of the given StringBuffer object.
 String toString()
          Called to query the string representation of the Tcl object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

duplicate

public InternalRep duplicate()
Returns a dupilcate of the current object.

Specified by:
duplicate in interface InternalRep

getSbuf

public StringBuffer getSbuf()
Return the internal StringBuffer. Used by TclInputStream as a shortcut.

Returns:
sbuf, the internal StringBuffer.

dispose

public void dispose()
Implement this no-op for the InternalRep interface.

Specified by:
dispose in interface InternalRep

toString

public String toString()
Called to query the string representation of the Tcl object. This method is called only by TclObject.toString() when TclObject.stringRep is null.

Overrides:
toString in class Object
Returns:
the string representation of the Tcl object.

newInstance

public static TclObject newInstance(String str)
Create a new TclObject that has a string representation with the given string value.


newInstance

public static TclObject newInstance(StringBuffer sb)
Create a new TclObject that makes use of the given StringBuffer object. The passed in StringBuffer should not be modified after it is passed to this method.


newInstance

public static final TclObject newInstance(Object o)

newInstance

public static final TclObject newInstance(char c)
Create a TclObject with an internal TclString representation whose initial value is a string with the single character.

Parameters:
c - initial value of the string.

append

public static final void append(TclObject tobj,
                                String string)
Appends a string to a TclObject object. This method is equivalent to Tcl_AppendToObj() in Tcl 8.0.

Parameters:
tobj - the TclObject to append a string to.
string - the string to append to the object.

append

public static final void append(TclObject tobj,
                                char[] charArr,
                                int offset,
                                int length)
Appends an array of characters to a TclObject Object. Tcl_AppendUnicodeToObj() in Tcl 8.0.

Parameters:
tobj - the TclObject to append a string to.
charArr - array of characters.
offset - index of first character to append.
length - number of characters to append.

append

public static final void append(TclObject tobj,
                                TclObject tobj2)
Appends a TclObject to a TclObject. This method is equivalent to Tcl_AppendToObj() in Tcl 8.0. The type of the TclObject will be a TclString that contains the string value: tobj.toString() + tobj2.toString();


append

public static final void append(TclObject tobj,
                                TclObject[] objv,
                                int startIdx,
                                int endIdx)
Appends the String values of multiple TclObject's to a TclObject. This is an optimized implementation that will measure the length of each string and expand the capacity as needed to limit reallocations.

Parameters:
tobj - the TclObject to append elements to.
objv - array containing elements to append.
startIdx - index to start appending values from
endIdx - index to stop appending values at

empty

public static void empty(TclObject tobj)
This procedure clears out an existing TclObject so that it has a string representation of "". This method is used only in the IO layer.



Copyright © 2015. All rights reserved.