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

public abstract Class Utility

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .CharArrayReader, .CharArrayWriter, .FilterReader, .FilterWriter, .IOException, .PrintStream, .PrintWriter, .Reader, .Writer, java.util.ArrayList, .Arrays, .List, .Locale, java.util.zip.GZIPInputStream, .GZIPOutputStream, com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.util.ByteSequence

Utility functions that do not really belong to any class in particular.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
Utility.JavaReader

Decode characters into bytes.

private static class
Utility.JavaWriter

Encode bytes into valid java identifier characters.

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final ThreadLocal<Integer>
private static final char
private static final int
private static final int[]
private static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

String representation of flags
accessToString
(final int
Access flags
accessFlags
)

Convert bit field of flags into string such as 'static final'.

public static String

Returns:

String representation of flags
accessToString
(final int
Access flags
accessFlags
,
final boolean
access flags are for class qualifiers ?
forClass
)

Convert bit field of flags into string such as 'static final'.

private static short
byteToShort(final byte b)

Convert (signed) byte to (unsigned) short value, i.e., all negative values become positive.

public static String

Returns:

"class" or "interface", depending on the ACC_INTERFACE flag
classOrInterface
(final int
the class flags
accessFlags
)

public static int

Returns:

'flag' with bit 'i' set to 0
clearBit
(final int flag, final int i)

public static String
codeToString(final byte[] code, final ConstantPool constantPool, final int index, final int length)

public static String

Returns:

String representation of byte codes
codeToString
(final byte[]
byte code array
code
,
final ConstantPool
Array of constants
constantPool
,
final int
offset in 'code' array (number of opcodes, not bytes!)
index
,
final int
number of opcodes to decompile, -1 for all
length
,
final boolean
be verbose, e.g. print constant pool index
verbose
)

Disassemble a byte array of JVM byte codes starting from code line 'index' and return the disassembled string representation.

public static String
codeToString(final ByteSequence bytes, final ConstantPool constantPool)

public static String

Returns:

String representation of byte code
codeToString
(final ByteSequence
stream of bytes
bytes
,
final ConstantPool
Array of constants
constantPool
,
final boolean
be verbose, e.g. print constant pool index
verbose
)

Disassemble a stream of byte codes and return the string representation.

public static String

Returns:

Compacted class name
compactClassName
(final String
The long class name
str
)

Shorten long class names, java/lang/String becomes String.

public static String

Returns:

Compacted class name
compactClassName
(final String
The long class name
str
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Shorten long class names, java/lang/String becomes java.lang.String, e.g..

public static String

Returns:

Compacted class name
compactClassName
(String
The long class name
str
,
final String
The prefix the get rid off
prefix
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Shorten long class name str, i.e., chop off the prefix, if the class name starts with this string and the flag chopit is true.

public static String
convertString(final String label)

Escape all occurrences of newline chars '\n', quotes \", etc.

private static int
countBrackets(final String brackets)

public static byte[]
decode(final String
the string to convert
s
,
final boolean
use gzip to uncompress the stream of bytes
uncompress
)

Decode a string back to a byte array.

public static String
encode(byte[]
the byte array to convert
bytes
,
final boolean
use gzip to minimize string
compress
)

Encode byte array it into Java identifier string, i.e., a string that only contains the following characters: (a, ...

public static String

Returns:

formatted string
fillup
(final String
string to format
str
,
final int
length of desired string
length
,
final boolean
format left or right
leftJustify
,
final char
fill character
fill
)

Fillup char with up to length characters with char 'fill' and justify it left or right.

public static String

Returns:

formatted int
format
(final int
integer to format
i
,
final int
length of desired string
length
,
final boolean
format left or right
leftJustify
,
final char
fill character
fill
)

Return a string for an integer justified left or right and filled up with 'fill' characters if necessary.

public static String

Returns:

byte code signature
getSignature
(String
Java type
type
)

Parse Java type such as "char", or "java.lang.String[]" and return the signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.

public static boolean

Returns:

true, if character is one of (a, ... z, A, ... Z, 0, ... 9, _)
isJavaIdentifierPart
(final char
the character to test if it's part of an identifier
ch
)

public static boolean

Returns:

true, if bit 'i' in 'flag' is set
isSet
(final int flag, final int i)

public static String[]

Returns:

String Array of argument types
methodSignatureArgumentTypes
(final String
Method signature
signature
)

Converts argument list portion of method signature to string with all class names compacted.

public static String[]

Returns:

String Array of argument types
methodSignatureArgumentTypes
(final String
Method signature
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts argument list portion of method signature to string.

public static String

Returns:

String representation of method return type
methodSignatureReturnType
(final String
Method signature
signature
)

Converts return type portion of method signature to string with all class names compacted.

public static String

Returns:

String representation of method return type
methodSignatureReturnType
(final String
Method signature
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts return type portion of method signature to string.

public static String

Returns:

Human readable signature
methodSignatureToString
(final String
to convert
signature
,
final String
of method
name
,
final String
flags of method
access
)

Converts method signature to string with all class names compacted.

public static String

Returns:

Human readable signature
methodSignatureToString
(final String
to convert
signature
,
final String
of method
name
,
final String
flags of method
access
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts method signature to string.

public static String

Returns:

Java type declaration
methodSignatureToString
(final String
Method signature
signature
,
final String
Method name
name
,
final String
Method access rights
access
,
final boolean
flag that determines whether chopping is executed or not
chopit
,
final LocalVariableTable
the LocalVariableTable for the method
vars
)

This method converts a method signature string into a Java type declaration like 'void main(String[])' and throws a 'ClassFormatException' when the parsed type is invalid.

public static String

Returns:

Byte code representation of method signature
methodTypeToSignature
(final String
Return type of method
ret
,
final String[]
Types of method arguments
argv
)

Converts string containing the method return and argument types to a byte code method signature.

public static String

Returns:

converted value
packageToPath
(final String
Source
name
)

Converts '.'s to '/'s.

public static String

Returns:

a package name.
pathToPackage
(final String
the source path.
str
)

Converts a path to a package name.

private static int
pow2(final int n)

public static String
printArray(final Object[] obj)

public static String
printArray(final Object[] obj, final boolean braces)

public static String
printArray(final Object[] obj, final boolean braces, final boolean quote)

public static void
printArray(final PrintStream out, final Object[] obj)

public static void
printArray(final PrintWriter out, final Object[] obj)

public static String

Returns:

new String object
replace
(String
String to permute
str
,
final String
String to be replaced
old
,
final String
Replacement string
new_
)

Replace all occurrences of old in str with new.

public static short
searchOpcode(String name)

Map opcode names to opcode numbers.

public static int

Returns:

'flag' with bit 'i' set to 1
setBit
(final int flag, final int i)

public static String

Returns:

String containg human readable signature
signatureToString
(final String
signature to convert
signature
)

Converts a signature to a string with all class names compacted.

public static String

Returns:

String containg human readable signature
signatureToString
(final String
signature to convert
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts a signature to a string.

public static String

Returns:

bytes as hexadecimal string, e.g. 00 fa 12 ...
toHexString
(final byte[]
an array of bytes to convert to hexadecimal
bytes
)

Convert bytes into hexadecimal string

public static byte

Returns:

type of method signature
typeOfMethodSignature
(final String
in format described above
signature
)

Return type of method signature as a byte value as defined in Constants

public static byte

Returns:

type of signature
typeOfSignature
(final String
in format described above
signature
)

Return type of signature as a byte value as defined in Constants

private static String

Returns:

String containg human readable signature
typeParamTypesToString
(final String
signature to convert
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts a type parameter list signature to a string.

private static String

Returns:

String containg human readable signature
typeParamTypeToString
(final String
signature to convert
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

Converts a type parameter signature to a string.

private static String

Returns:

String containg human readable signature
typeSignaturesToString
(final String
signature to convert
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
,
final char
character indicating the end of the list
term
)

Converts a list of type signatures to a string.

public static String

Returns:

string containing human readable type signature
typeSignatureToString
(final String
type signature
signature
,
final boolean
flag that determines whether chopping is executed or not
chopit
)

This method converts a type signature string into a Java type declaration such as 'String[]' and throws a 'ClassFormatException' when the parsed type is invalid.

private static int
private static void
wrap(final ThreadLocal<Integer> tl, final int value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHAR_MAPback to summary
private static final int[] CHAR_MAP
CONSUMER_CHARSback to summary
private static final ThreadLocal<Integer> CONSUMER_CHARS
ESCAPE_CHARback to summary
private static final char ESCAPE_CHAR
FREE_CHARSback to summary
private static final int FREE_CHARS
MAP_CHARback to summary
private static final int[] MAP_CHAR
wideback to summary
private static boolean wide

Constructor Detail

Utilityback to summary
public Utility()

Method Detail

accessToStringback to summary
public static String accessToString(final int accessFlags)

Convert bit field of flags into string such as 'static final'.

Parameters
accessFlags:int

Access flags

Returns:String

String representation of flags

accessToStringback to summary
public static String accessToString(final int accessFlags, final boolean forClass)

Convert bit field of flags into string such as 'static final'. Special case: Classes compiled with new compilers and with the 'ACC_SUPER' flag would be said to be "synchronized". This is because SUN used the same value for the flags 'ACC_SUPER' and 'ACC_SYNCHRONIZED'.

Parameters
accessFlags:int

Access flags

forClass:boolean

access flags are for class qualifiers ?

Returns:String

String representation of flags

byteToShortback to summary
private static short byteToShort(final byte b)

Convert (signed) byte to (unsigned) short value, i.e., all negative values become positive.

classOrInterfaceback to summary
public static String classOrInterface(final int accessFlags)
Parameters
accessFlags:int

the class flags

Returns:String

"class" or "interface", depending on the ACC_INTERFACE flag

clearBitback to summary
public static int clearBit(final int flag, final int i)
Returns:int

'flag' with bit 'i' set to 0

codeToStringback to summary
public static String codeToString(final byte[] code, final ConstantPool constantPool, final int index, final int length)
codeToStringback to summary
public static String codeToString(final byte[] code, final ConstantPool constantPool, final int index, final int length, final boolean verbose)

Disassemble a byte array of JVM byte codes starting from code line 'index' and return the disassembled string representation. Decode only 'num' opcodes (including their operands), use -1 if you want to decompile everything.

Parameters
code:byte[]

byte code array

constantPool:ConstantPool

Array of constants

index:int

offset in 'code' array (number of opcodes, not bytes!)

length:int

number of opcodes to decompile, -1 for all

verbose:boolean

be verbose, e.g. print constant pool index

Returns:String

String representation of byte codes

codeToStringback to summary
public static String codeToString(final ByteSequence bytes, final ConstantPool constantPool) throws IOException
codeToStringback to summary
public static String codeToString(final ByteSequence bytes, final ConstantPool constantPool, final boolean verbose) throws IOException

Disassemble a stream of byte codes and return the string representation.

Parameters
bytes:ByteSequence

stream of bytes

constantPool:ConstantPool

Array of constants

verbose:boolean

be verbose, e.g. print constant pool index

Returns:String

String representation of byte code

Annotations
@SuppressWarnings:fallthrough
Exceptions
IOException:
if a failure from reading from the bytes argument occurs
compactClassNameback to summary
public static String compactClassName(final String str)

Shorten long class names, java/lang/String becomes String.

Parameters
str:String

The long class name

Returns:String

Compacted class name

compactClassNameback to summary
public static String compactClassName(final String str, final boolean chopit)

Shorten long class names, java/lang/String becomes java.lang.String, e.g.. If chopit is true the prefix java.lang is also removed.

Parameters
str:String

The long class name

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

Compacted class name

compactClassNameback to summary
public static String compactClassName(String str, final String prefix, final boolean chopit)

Shorten long class name str, i.e., chop off the prefix, if the class name starts with this string and the flag chopit is true. Slashes / are converted to dots ..

Parameters
str:String

The long class name

prefix:String

The prefix the get rid off

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

Compacted class name

convertStringback to summary
public static String convertString(final String label)

Escape all occurrences of newline chars '\n', quotes \", etc.

countBracketsback to summary
private static int countBrackets(final String brackets)
decodeback to summary
public static byte[] decode(final String s, final boolean uncompress) throws IOException

Decode a string back to a byte array.

Parameters
s:String

the string to convert

uncompress:boolean

use gzip to uncompress the stream of bytes

Exceptions
IOException:
if there's a gzip exception
encodeback to summary
public static String encode(byte[] bytes, final boolean compress) throws IOException

Encode byte array it into Java identifier string, i.e., a string that only contains the following characters: (a, ... z, A, ... Z, 0, ... 9, _, $). The encoding algorithm itself is not too clever: if the current byte's ASCII value already is a valid Java identifier part, leave it as it is. Otherwise it writes the escape character($) followed by:

  • the ASCII value as a hexadecimal string, if the value is not in the range 200..247
  • a Java identifier char not used in a lowercase hexadecimal string, if the value is in the range 200..247

This operation inflates the original byte array by roughly 40-50%

Parameters
bytes:byte[]

the byte array to convert

compress:boolean

use gzip to minimize string

Exceptions
IOException:
if there's a gzip exception
fillupback to summary
public static String fillup(final String str, final int length, final boolean leftJustify, final char fill)

Fillup char with up to length characters with char 'fill' and justify it left or right.

Parameters
str:String

string to format

length:int

length of desired string

leftJustify:boolean

format left or right

fill:char

fill character

Returns:String

formatted string

formatback to summary
public static String format(final int i, final int length, final boolean leftJustify, final char fill)

Return a string for an integer justified left or right and filled up with 'fill' characters if necessary.

Parameters
i:int

integer to format

length:int

length of desired string

leftJustify:boolean

format left or right

fill:char

fill character

Returns:String

formatted int

getSignatureback to summary
public static String getSignature(String type)

Parse Java type such as "char", or "java.lang.String[]" and return the signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.

Parameters
type:String

Java type

Returns:String

byte code signature

isJavaIdentifierPartback to summary
public static boolean isJavaIdentifierPart(final char ch)
Parameters
ch:char

the character to test if it's part of an identifier

Returns:boolean

true, if character is one of (a, ... z, A, ... Z, 0, ... 9, _)

isSetback to summary
public static boolean isSet(final int flag, final int i)
Returns:boolean

true, if bit 'i' in 'flag' is set

methodSignatureArgumentTypesback to summary
public static String[] methodSignatureArgumentTypes(final String signature) throws ClassFormatException

Converts argument list portion of method signature to string with all class names compacted.

Parameters
signature:String

Method signature

Returns:String[]

String Array of argument types

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
methodSignatureArgumentTypesback to summary
public static String[] methodSignatureArgumentTypes(final String signature, final boolean chopit) throws ClassFormatException

Converts argument list portion of method signature to string.

Parameters
signature:String

Method signature

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String[]

String Array of argument types

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
methodSignatureReturnTypeback to summary
public static String methodSignatureReturnType(final String signature) throws ClassFormatException

Converts return type portion of method signature to string with all class names compacted.

Parameters
signature:String

Method signature

Returns:String

String representation of method return type

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
methodSignatureReturnTypeback to summary
public static String methodSignatureReturnType(final String signature, final boolean chopit) throws ClassFormatException

Converts return type portion of method signature to string.

Parameters
signature:String

Method signature

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

String representation of method return type

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
methodSignatureToStringback to summary
public static String methodSignatureToString(final String signature, final String name, final String access)

Converts method signature to string with all class names compacted.

Parameters
signature:String

to convert

name:String

of method

access:String

flags of method

Returns:String

Human readable signature

methodSignatureToStringback to summary
public static String methodSignatureToString(final String signature, final String name, final String access, final boolean chopit)

Converts method signature to string.

Parameters
signature:String

to convert

name:String

of method

access:String

flags of method

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

Human readable signature

methodSignatureToStringback to summary
public static String methodSignatureToString(final String signature, final String name, final String access, final boolean chopit, final LocalVariableTable vars) throws ClassFormatException

This method converts a method signature string into a Java type declaration like 'void main(String[])' and throws a 'ClassFormatException' when the parsed type is invalid.

Parameters
signature:String

Method signature

name:String

Method name

access:String

Method access rights

chopit:boolean

flag that determines whether chopping is executed or not

vars:LocalVariableTable

the LocalVariableTable for the method

Returns:String

Java type declaration

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
methodTypeToSignatureback to summary
public static String methodTypeToSignature(final String ret, final String[] argv) throws ClassFormatException

Converts string containing the method return and argument types to a byte code method signature.

Parameters
ret:String

Return type of method

argv:String[]

Types of method arguments

Returns:String

Byte code representation of method signature

Exceptions
ClassFormatException:
if the signature is for Void
packageToPathback to summary
public static String packageToPath(final String name)

Converts '.'s to '/'s.

Parameters
name:String

Source

Returns:String

converted value

Since
6.7.0
pathToPackageback to summary
public static String pathToPackage(final String str)

Converts a path to a package name.

Parameters
str:String

the source path.

Returns:String

a package name.

Since
6.6.0
pow2back to summary
private static int pow2(final int n)
printArrayback to summary
public static String printArray(final Object[] obj)
printArrayback to summary
public static String printArray(final Object[] obj, final boolean braces)
printArrayback to summary
public static String printArray(final Object[] obj, final boolean braces, final boolean quote)
printArrayback to summary
public static void printArray(final PrintStream out, final Object[] obj)
printArrayback to summary
public static void printArray(final PrintWriter out, final Object[] obj)
replaceback to summary
public static String replace(String str, final String old, final String new_)

Replace all occurrences of old in str with new.

Parameters
str:String

String to permute

old:String

String to be replaced

new_:String

Replacement string

Returns:String

new String object

searchOpcodeback to summary
public static short searchOpcode(String name)

Map opcode names to opcode numbers. E.g., return Constants.ALOAD for "aload"

setBitback to summary
public static int setBit(final int flag, final int i)
Returns:int

'flag' with bit 'i' set to 1

signatureToStringback to summary
public static String signatureToString(final String signature)

Converts a signature to a string with all class names compacted. Class, Method and Type signatures are supported. Enum and Interface signatures are not supported.

Parameters
signature:String

signature to convert

Returns:String

String containg human readable signature

signatureToStringback to summary
public static String signatureToString(final String signature, final boolean chopit)

Converts a signature to a string. Class, Method and Type signatures are supported. Enum and Interface signatures are not supported.

Parameters
signature:String

signature to convert

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

String containg human readable signature

toHexStringback to summary
public static String toHexString(final byte[] bytes)

Convert bytes into hexadecimal string

Parameters
bytes:byte[]

an array of bytes to convert to hexadecimal

Returns:String

bytes as hexadecimal string, e.g. 00 fa 12 ...

typeOfMethodSignatureback to summary
public static byte typeOfMethodSignature(final String signature) throws ClassFormatException

Return type of method signature as a byte value as defined in Constants

Parameters
signature:String

in format described above

Returns:byte

type of method signature

Exceptions
ClassFormatException:
if signature is not a method signature
See Also
Const
typeOfSignatureback to summary
public static byte typeOfSignature(final String signature) throws ClassFormatException

Return type of signature as a byte value as defined in Constants

Parameters
signature:String

in format described above

Returns:byte

type of signature

Exceptions
ClassFormatException:
if signature isn't a known type
See Also
Const
typeParamTypesToStringback to summary
private static String typeParamTypesToString(final String signature, final boolean chopit)

Converts a type parameter list signature to a string.

Parameters
signature:String

signature to convert

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

String containg human readable signature

typeParamTypeToStringback to summary
private static String typeParamTypeToString(final String signature, final boolean chopit)

Converts a type parameter signature to a string.

Parameters
signature:String

signature to convert

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

String containg human readable signature

typeSignaturesToStringback to summary
private static String typeSignaturesToString(final String signature, final boolean chopit, final char term)

Converts a list of type signatures to a string.

Parameters
signature:String

signature to convert

chopit:boolean

flag that determines whether chopping is executed or not

term:char

character indicating the end of the list

Returns:String

String containg human readable signature

typeSignatureToStringback to summary
public static String typeSignatureToString(final String signature, final boolean chopit) throws ClassFormatException

This method converts a type signature string into a Java type declaration such as 'String[]' and throws a 'ClassFormatException' when the parsed type is invalid.

Parameters
signature:String

type signature

chopit:boolean

flag that determines whether chopping is executed or not

Returns:String

string containing human readable type signature

Exceptions
ClassFormatException:
if a class is malformed or cannot be interpreted as a class file
Since
6.4.0
unwrapback to summary
private static int unwrap(final ThreadLocal<Integer> tl)
wrapback to summary
private static void wrap(final ThreadLocal<Integer> tl, final int value)
com.sun.org.apache.bcel.internal.classfile back to summary

private Class Utility.JavaReader

extends FilterReader
Class Inheritance

Decode characters into bytes. Used by decode()

Field Summary

Inherited from java.io.FilterReader:
in

Constructor Summary

AccessConstructor and Description
public
JavaReader(final Reader in)

Method Summary

Modifier and TypeMethod and Description
public int
read()

Overrides java.io.FilterReader.read.

Reads a single character.
public int
read(final char[]
Destination buffer
cbuf
,
final int
Offset at which to start storing characters
off
,
final int
Maximum number of characters to read
len
)

Overrides java.io.FilterReader.read.

Reads characters into a portion of an array.
Inherited from java.io.FilterReader:
closemarkmarkSupportedreadyresetskip

Constructor Detail

JavaReaderback to summary
public JavaReader(final Reader in)

Method Detail

readback to summary
public int read() throws IOException

Overrides java.io.FilterReader.read.

Doc from java.io.FilterReader.read.

Reads a single character.

Returns:int

Doc from java.io.Reader.read.

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readback to summary
public int read(final char[] cbuf, final int off, final int len) throws IOException

Overrides java.io.FilterReader.read.

Doc from java.io.FilterReader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Parameters
cbuf:char[]

Doc from java.io.Reader.read.

Destination buffer

off:int

Doc from java.io.Reader.read.

Offset at which to start storing characters

len:int

Doc from java.io.Reader.read.

Maximum number of characters to read

Returns:int

Doc from java.io.Reader.read.

The number of characters read, or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Reader.read.

If an I/O error occurs

com.sun.org.apache.bcel.internal.classfile back to summary

private Class Utility.JavaWriter

extends FilterWriter
Class Inheritance

Encode bytes into valid java identifier characters. Used by encode()

Field Summary

Inherited from java.io.FilterWriter:
out

Constructor Summary

AccessConstructor and Description
public
JavaWriter(final Writer out)

Method Summary

Modifier and TypeMethod and Description
public void
write(final char[]
Buffer of characters to be written
cbuf
,
final int
Offset from which to start reading characters
off
,
final int
Number of characters to be written
len
)

Overrides java.io.FilterWriter.write.

Writes a portion of an array of characters.
public void
write(final int
int specifying a character to be written
b
)

Overrides java.io.FilterWriter.write.

Writes a single character.
public void
write(final String
String to be written
str
,
final int
Offset from which to start reading characters
off
,
final int
Number of characters to be written
len
)

Overrides java.io.FilterWriter.write.

Writes a portion of a string.
Inherited from java.io.FilterWriter:
closeflush

Constructor Detail

JavaWriterback to summary
public JavaWriter(final Writer out)

Method Detail

writeback to summary
public void write(final char[] cbuf, final int off, final int len) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a portion of an array of characters.

Parameters
cbuf:char[]

Buffer of characters to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(final int b) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a single character.

Parameters
b:int

Doc from java.io.Writer.write.

int specifying a character to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(final String str, final int off, final int len) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a portion of a string.

Parameters
str:String

String to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs