|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.shared_tomahawk.util.StringCharArrayAccessor
public class StringCharArrayAccessor
Provides optimized access to java.lang.String internals - Optimized way of creating java.lang.String by reusing a char[] buffer - Optimized way of writing String to java.io.Writer java.lang.String creation reusing a char[] buffer requires Java 1.5+ System property "oam.stringchararrayaccessor.enabled" enables this hack. -Doam.stringchararrayaccessor.enabled=true Read JSR-133, "9.1.1 Post-Construction Modification of Final Fields" http://www.cs.umd.edu/~pugh/java/memoryModel/jsr133.pdf
file licensed under ASL v2.0
Copyright 2009 the original author or authors.
Constructor Summary | |
---|---|
StringCharArrayAccessor()
|
Method Summary | |
---|---|
static String |
createString(char[] charBuf)
creates a new java.lang.String by setting the char array directly to the String instance with reflection. |
static boolean |
isEnabled()
|
static void |
writeStringAsCharArray(Writer writer,
String str)
Writes a portion of a string to a target java.io.Writer with direct access to the char[] of the java.lang.String |
static void |
writeStringAsCharArray(Writer writer,
String str,
int off,
int len)
Writes a portion of a string to a target java.io.Writer with direct access to the char[] of the java.lang.String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringCharArrayAccessor()
Method Detail |
---|
public static void writeStringAsCharArray(Writer writer, String str) throws IOException
writer
- target java.io.Writer for outputstr
- A String
IOException
- If an I/O error occurspublic static void writeStringAsCharArray(Writer writer, String str, int off, int len) throws IOException
writer
- target java.io.Writer for outputstr
- A Stringoff
- Offset from which to start writing characterslen
- Number of characters to write
IOException
- If an I/O error occurspublic static String createString(char[] charBuf)
charBuf
- char array to be used as java.lang.String content, don't modify it after passing it.
public static boolean isEnabled()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |