APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public final Class ConstantUtf8

extends Constant
Class Inheritance
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.HashMap, .LinkedHashMap, .Map, .Objects, com.sun.org.apache.bcel.internal.Const

Extends the abstract Constant to represent a reference to a UTF-8 encoded string.

The following system properties govern caching this class performs.

Here is a sample Maven invocation with caching disabled:

mvn test -Dbcel.statistics=true -Dbcel.maxcached.size=0 -Dbcel.maxcached=0

Here is a sample Maven invocation with caching enabled:

mvn test -Dbcel.statistics=true -Dbcel.maxcached.size=100000 -Dbcel.maxcached=5000000
See Also
Constant

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static volatile int
private static volatile int
private static volatile int
private static volatile int
private static final String
private static final String
private static final String
private final String
Inherited from com.sun.org.apache.bcel.internal.classfile.Constant:
EMPTY_ARRAYtag

Constructor Summary

AccessConstructor and Description
public
ConstantUtf8(final ConstantUtf8
the value.
constantUtf8
)

Initializes from another object.

pack-priv
ConstantUtf8(final DataInput
Input stream
dataInput
)

Initializes instance from file data.

public
ConstantUtf8(final String
Data
value
)

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Constant.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.

public static synchronized void
clearCache()

Clears the cache.

pack-priv static synchronized void
private static void
public void
dump(final DataOutputStream
Output file stream
file
)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Constant.dump.

Dumps String in Utf8 format to file stream.

public String
getBytes()

Returns: Data converted to string.

public static ConstantUtf8

Returns:

a new or cached instance of the given value.
getCachedInstance
(final String
the value.
value
)

Gets a new or cached instance of the given value.

public static ConstantUtf8

Returns:

a new or cached instance of the given value.
getInstance
(final DataInput
the value.
dataInput
)

Gets a new or cached instance of the given value.

public static ConstantUtf8

Returns:

a new or cached instance of the given value.
getInstance
(final String
the value.
value
)

Gets a new or cached instance of the given value.

pack-priv static void
public void
setBytes(final String
the raw bytes of this UTF-8
bytes
)
Deprecated (since 6.0)

public String

Returns:

String representation
toString
()

Overrides com.sun.org.apache.bcel.internal.classfile.Constant.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.classfile.Constant:
clonecopyequalsgetComparatorgetTaghashCodereadConstantsetComparator

Field Detail

consideredback to summary
private static volatile int considered
createdback to summary
private static volatile int created
hitsback to summary
private static volatile int hits
skippedback to summary
private static volatile int skipped
SYS_PROP_CACHE_MAX_ENTRIESback to summary
private static final String SYS_PROP_CACHE_MAX_ENTRIES
SYS_PROP_CACHE_MAX_ENTRY_SIZEback to summary
private static final String SYS_PROP_CACHE_MAX_ENTRY_SIZE
SYS_PROP_STATISTICSback to summary
private static final String SYS_PROP_STATISTICS
valueback to summary
private final String value

Constructor Detail

ConstantUtf8back to summary
public ConstantUtf8(final ConstantUtf8 constantUtf8)

Initializes from another object.

Parameters
constantUtf8:ConstantUtf8

the value.

ConstantUtf8back to summary
pack-priv ConstantUtf8(final DataInput dataInput) throws IOException

Initializes instance from file data.

Parameters
dataInput:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs.
ConstantUtf8back to summary
public ConstantUtf8(final String value)
Parameters
value:String

Data

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Constant.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
clearCacheback to summary
public static synchronized void clearCache()

Clears the cache.

Since
6.4.0
clearStatsback to summary
pack-priv static synchronized void clearStats()
countCreatedback to summary
private static void countCreated()
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Implements abstract com.sun.org.apache.bcel.internal.classfile.Constant.dump.

Dumps String in Utf8 format to file stream.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getBytesback to summary
public String getBytes()
Returns:String

Data converted to string.

getCachedInstanceback to summary
public static ConstantUtf8 getCachedInstance(final String value)

Gets a new or cached instance of the given value.

See ConstantUtf8 class Javadoc for details.

Parameters
value:String

the value.

Returns:ConstantUtf8

a new or cached instance of the given value.

Since
6.0
getInstanceback to summary
public static ConstantUtf8 getInstance(final DataInput dataInput) throws IOException

Gets a new or cached instance of the given value.

See ConstantUtf8 class Javadoc for details.

Parameters
dataInput:DataInput

the value.

Returns:ConstantUtf8

a new or cached instance of the given value.

Exceptions
IOException:
if an I/O error occurs.
Since
6.0
getInstanceback to summary
public static ConstantUtf8 getInstance(final String value)

Gets a new or cached instance of the given value.

See ConstantUtf8 class Javadoc for details.

Parameters
value:String

the value.

Returns:ConstantUtf8

a new or cached instance of the given value.

Since
6.0
printStatsback to summary
pack-priv static void printStats()
setBytesback to summary
public void setBytes(final String bytes)

Deprecated

(since 6.0)

Parameters
bytes:String

the raw bytes of this UTF-8

Annotations
@Deprecated
toStringback to summary
public String toString()

Overrides com.sun.org.apache.bcel.internal.classfile.Constant.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation

Annotations
@Override
com.sun.org.apache.bcel.internal.classfile back to summary

private final Class ConstantUtf8.Cache

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.org.apache.bcel.internal.classfile.ConstantUtf8.Cache

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final HashMap<String, ConstantUtf8>
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BCEL_STATISTICSback to summary
private static final boolean BCEL_STATISTICS
CACHEback to summary
private static final HashMap<String, ConstantUtf8> CACHE
INITIAL_CAPACITYback to summary
private static final int INITIAL_CAPACITY
MAX_ENTRIESback to summary
private static final int MAX_ENTRIES
MAX_ENTRY_SIZEback to summary
private static final int MAX_ENTRY_SIZE

Constructor Detail

Cacheback to summary
private Cache()

Method Detail

isEnabledback to summary
pack-priv static boolean isEnabled()