fr.dyade.aaa.common
Class Strings

java.lang.Object
  extended by fr.dyade.aaa.common.Strings

public class Strings
extends java.lang.Object

This class provides a set of static functions for building string representations of complex structures.


Field Summary
static int listBorder
          Controls the default formatting of lists of objects.
static int listMax
          Controls the default formatting of lists of objects.
 
Constructor Summary
Strings()
           
 
Method Summary
static void toByteArray(java.io.ByteArrayOutputStream output, java.lang.String str)
          Provides a Java string literal representing the parameter string.
static java.lang.String toString(java.util.Collection set)
          Provides a string representation of an unordered Collection of objects.
static java.lang.String toString(java.util.List list)
          Provides a string representation of a list of objects.
static java.lang.String toString(java.util.Map map)
          Provides a string representation of a Map.
static java.lang.String toString(java.lang.Object obj)
          Provides a string representation of an object.
static java.lang.String toString(java.lang.String str)
          Provides a Java string literal representing the parameter string.
static void toString(java.lang.StringBuffer output, boolean[] tab)
          Provides a string representation of an array of booleans.
static void toString(java.lang.StringBuffer output, boolean[] tab, int listMax, int listBorder)
          Provides a string representation of an array of booleans.
static void toString(java.lang.StringBuffer output, byte[] tab)
          Provides a string representation of an array of bytes.
static void toString(java.lang.StringBuffer output, byte[] tab, int listMax, int listBorder)
          Provides a string representation of an array of bytes.
static void toString(java.lang.StringBuffer output, char[] tab)
          Provides a string representation of an array of chars.
static void toString(java.lang.StringBuffer output, char[] tab, int listMax, int listBorder)
          Provides a string representation of an array of chars.
static void toString(java.lang.StringBuffer output, java.util.Collection set)
          Provides a string representation of an unordered Collection of objects.
static void toString(java.lang.StringBuffer output, java.util.Collection set, int listMax, int listBorder)
          Provides a string representation of an unordered Collection of objects.
static void toString(java.lang.StringBuffer output, double[] tab)
          Provides a string representation of an array of doubles.
static void toString(java.lang.StringBuffer output, double[] tab, int listMax, int listBorder)
          Provides a string representation of an array of doubles.
static void toString(java.lang.StringBuffer output, float[] tab)
          Provides a string representation of an array of floats.
static void toString(java.lang.StringBuffer output, float[] tab, int listMax, int listBorder)
          Provides a string representation of an array of floats.
static void toString(java.lang.StringBuffer output, int[] tab)
          Provides a string representation of an array of ints.
static void toString(java.lang.StringBuffer output, int[] tab, int listMax, int listBorder)
          Provides a string representation of an array of ints.
static void toString(java.lang.StringBuffer output, java.util.List list)
          Provides a string representation of a list of objects.
static void toString(java.lang.StringBuffer output, java.util.List list, int listMax, int listBorder)
          Provides a string representation of a list of objects.
static void toString(java.lang.StringBuffer output, long[] tab)
          Provides a string representation of an array of longs.
static void toString(java.lang.StringBuffer output, long[] tab, int listMax, int listBorder)
          Provides a string representation of an array of longs.
static void toString(java.lang.StringBuffer output, java.util.Map.Entry entry)
          Provides a string representation of a Map entry.
static void toString(java.lang.StringBuffer output, java.util.Map map)
          Provides a string representation of a Map.
static void toString(java.lang.StringBuffer output, java.lang.Object obj)
          Provides a string representation of an object.
static void toString(java.lang.StringBuffer output, java.lang.Object[] tab)
          Provides a string representation of an array of objects.
static void toString(java.lang.StringBuffer output, java.lang.Object[] tab, int listMax, int listBorder)
          Provides a string representation of an array of objects.
static void toString(java.lang.StringBuffer output, java.lang.Object obj, java.lang.Class type)
          Provides a string representation of an array.
static void toString(java.lang.StringBuffer output, java.lang.Object obj, java.lang.Class type, int listMax, int listBorder)
          Provides a string representation of an array.
static void toString(java.lang.StringBuffer output, short[] tab)
          Provides a string representation of an array of shorts.
static void toString(java.lang.StringBuffer output, short[] tab, int listMax, int listBorder)
          Provides a string representation of an array of shorts.
static void toString(java.lang.StringBuffer output, java.lang.String str)
          Provides a Java string literal representing the parameter string.
static java.lang.String toStringArray(java.lang.Object tab)
          Provides a string representation of an array.
static void toStringArray(java.lang.StringBuffer output, java.lang.Object tab)
          Provides a string representation of an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listMax

public static int listMax
Controls the default formatting of lists of objects. By default lists with a number of elements up to listMax are entirely printed. A value of -1 leads to complete printing of the list, whatever its size.

This variable, when used in an agent server, may be set by the debug variable Debug.var.fr.dyade.aaa.util.listMax. Its default value is 10.


listBorder

public static int listBorder
Controls the default formatting of lists of objects. By default lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

This variable, when used in an agent server, may be set by the debug variable Debug.var.fr.dyade.aaa.util.listBorder. Its default value is is 3.

Constructor Detail

Strings

public Strings()
Method Detail

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.Object obj)
Provides a string representation of an object. Checks if there exists in this class a specialized toString function for the object class, or calls the toString function of the object.

Parameters:
output - a buffer to print the object into
obj - the object to print

toString

public static final java.lang.String toString(java.lang.Object obj)
Provides a string representation of an object. Calls toString(StringBuffer).

Parameters:
obj - the object to print
Returns:
a string representation of the object

toByteArray

public static final void toByteArray(java.io.ByteArrayOutputStream output,
                                     java.lang.String str)
Provides a Java string literal representing the parameter string. This includes surrounding double quotes, and quoted special characters, including UTF escape sequences when necessary.

This function works only for ASCII character encoding, and assumes this is the default encoding.

Parameters:
output - a byte buffer to print the object into
str - the string to print

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.String str)
Provides a Java string literal representing the parameter string. This includes surrounding double quotes, and quoted special characters, including UTF escape sequences when necessary.

This function works only for ASCII character encoding, and assumes this is the default encoding.

Parameters:
output - a string buffer to print the object into
str - the string to print

toString

public static final java.lang.String toString(java.lang.String str)
Provides a Java string literal representing the parameter string. This includes surrounding double quotes, and quoted special characters, including UTF escape sequences when necessary.

This function works only for ASCII character encoding, and assumes this is the default encoding.

Parameters:
str - the string to print
Returns:
a Java string literal representation of the string

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.Object obj,
                                  java.lang.Class type)
Provides a string representation of an array.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.Object obj,
                                  java.lang.Class type,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements. A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toStringArray

public static final void toStringArray(java.lang.StringBuffer output,
                                       java.lang.Object tab)
Provides a string representation of an array. Calls toString(StringBuffer, Object, Class).

Parameters:
output - a buffer to print the object into
tab - the array to print
type - the type of the array components

toStringArray

public static final java.lang.String toStringArray(java.lang.Object tab)
Provides a string representation of an array. Calls toString(StringBuffer, Object, Class).

Parameters:
tab - the array to print
Returns:
a string representation of the array
See Also:
toString(StringBuffer, Object, Class)

toString

public static final void toString(java.lang.StringBuffer output,
                                  boolean[] tab)
Provides a string representation of an array of booleans.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  boolean[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of booleans.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  byte[] tab)
Provides a string representation of an array of bytes.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  byte[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of bytes.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  char[] tab)
Provides a string representation of an array of chars.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  char[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of chars.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  short[] tab)
Provides a string representation of an array of shorts.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  short[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of shorts.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  int[] tab)
Provides a string representation of an array of ints.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  int[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of ints.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  long[] tab)
Provides a string representation of an array of longs.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  long[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of longs.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  float[] tab)
Provides a string representation of an array of floats.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  float[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of floats.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  double[] tab)
Provides a string representation of an array of doubles.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  double[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of doubles.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.Object[] tab)
Provides a string representation of an array of objects.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.lang.Object[] tab,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an array of objects.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
obj - the array to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.List list)
Provides a string representation of a list of objects. This includes Vectors.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
list - the list of Object objects to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.List list,
                                  int listMax,
                                  int listBorder)
Provides a string representation of a list of objects. This includes Vectors.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
list - the list of Object objects to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final java.lang.String toString(java.util.List list)
Provides a string representation of a list of objects. Calls toString(StringBuffer, ...).

Parameters:
list - the list of Object objects to print
Returns:
a string representation of the list

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.Collection set)
Provides a string representation of an unordered Collection of objects. This includes HashSets.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

Parameters:
output - a buffer to print the object into
set - the collection to print
type - the type of the array components
See Also:
listMax, listBorder

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.Collection set,
                                  int listMax,
                                  int listBorder)
Provides a string representation of an unordered Collection of objects. This includes HashSets.

Lists with a number of elements greater than listMax are partially printed, with the listBorder leading and trailing elements.

A value of -1 for listMax leads to complete printing of the list, whatever its size.

Parameters:
output - a buffer to print the object into
set - the collection to print
type - the type of the array components
listMax - Controls the formatting of lists of objects.
listBorder - Controls the formatting of lists of objects.

toString

public static final java.lang.String toString(java.util.Collection set)
Provides a string representation of an unordered Collection of objects. Calls toString(StringBuffer, ...).

Parameters:
list - the collection to print
Returns:
a string representation of the list

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.Map map)
Provides a string representation of a Map. This includes HashTables. Uses the listMax and listBorder variables.

Parameters:
output - a buffer to print the object into
map - the map to print

toString

public static final java.lang.String toString(java.util.Map map)
Provides a string representation of a Map. Calls toString(StringBuffer, ...).

Parameters:
map - the map to print
Returns:
a string representation of the map

toString

public static final void toString(java.lang.StringBuffer output,
                                  java.util.Map.Entry entry)
Provides a string representation of a Map entry.

Parameters:
output - a buffer to print the object into
entry - the map entry to print


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.