Skip to main content
Package: com.phoenix_int.aserver.util Class Hierarchy
Implemented Interfaces
  • java.io.Serializable
Declaration
Class that behaves like a java.lang.StringBuffer but has logic for caching out to disk if the size grows over a limit (currently 512K). Has additional functionality to make it perform better for large files and includes getReader() and getInputStream() to read the string linearly. See Also: Serialized Form

Field Summary

Constructor Summary

Method Summary

Methods inherited from class java.lang.Object

clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

SIZECUTOFF

See Also: Constant Field Values

Constructor Detail

PHXStringBuffer

Creates a new, empty string buffer

PHXStringBuffer

Creates a new, empty string buffer which has an internal buffer of the size specified. This is more efficient if you know the approximate size that the string will eventually be as it doesn’t have to guess small and grow. In particular, if the size is over the cutoff limit, it immediately caches to disk.

PHXStringBuffer

Creates a new string buffer which contains the specified string. Will cache to disk immediately if the length of the string is over the cutoff.

Method Detail

clear

This is for performance only, it allows large temp files and memory to be freed. This will happen when the garbage collector runs, but sometimes this is not good enough when you are dealing with large files.

append

Appends a string to this buffer

append

Appends a char array to this buffer

append

Appends a char array to this buffer Parameters:
  • offset - The offset to start copying at
  • len - The number of chars to copy

append

Appends a byte array using the default encoding

append

Appends a byte array using the default encoding

append

Appends a PHXStringBuffer to this buffer. In particular this is more efficient than using append(String) when one or both of the buffers are currently cached out to disk.

append

Fully reads the contents of InputStream into this buffer using UTF-8 encoding. Will not close the InputStream when done. Parameters:
  • in - The InputStream to read, should be in UTF-8 encoding.
Returns:
  • this
Throws:
  • java.io.IOException

append

Throws:
  • java.io.IOException

append

Appends an integer to this buffer

append

Appends a long to this buffer

append

Appends a float to this buffer

append

Appends a single char to this buffer

addEscapes

Convenience static for adding escapes to plain strings

addEscapes

addEscapes

addEscapesExtra

removeEscapes

removeEscapes

length

Returns the actual length of the string held by this buffer object.

toString

Returns a string representation of this object. NOTE: This is very bad performance for large files. Avoid this if possible if you know you will be handling large strings. Overrides:
  • toString in class java.lang.Object
See Also: getReader(), getInputStream()

getReader

Returns a Reader which can be read sequentially and contains the contents of the string. This is an efficient way to read the whole string.

getInputStream

Returns an InputStream which can be read sequentially and contains the contents of the string. This is an efficient way to read the whole string. The stream will be UTF-8 encoded.

charAt

Get the character at the specified index

indexOf

Searches for a given character and returns the index to that character, or -1 if not found

indexOf

indexOf

Searches for a given character and returns the index to that character, or -1 if not found

indexOf

indexOf

startsWith

Returns true if this string starts with the specified string

equals

Compares this to another String or PHXStringBuffer. Returns false if you pass in null. Overrides:
  • equals in class java.lang.Object

equalsIgnoreCase

Compares this to another String or PHXStringBuffer. Returns false if you pass in null. Is insensitive to case.

firstWord

Returns the first word of this string, whitespace delimited.

substring

Creates a PHXStringBuffer with the contents of this string starting at a specified point and going to the end of the string.

substring

Creates a PHXStringBuffer with the contents of this string starting at a specified point and including up to the character before the specified end point.

writeTo

Writes this string buffer out to an output stream efficiently does utf-8 conversion before writing Throws:
  • java.io.IOException