public class Utils
extends java.lang.Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
convertByteArrayToByteString(byte[] bytes)
When converting between String chars and bytes, there's an implied
encoding to be used, dependent on the context and platform.
|
static java.lang.String |
convertByteArrayToHexString(byte[] buffer,
boolean addSpaceSeparator) |
static java.lang.String |
convertByteArrayToHexString(byte[] buffer,
boolean addSpaceSeparator,
int addDelimiterEverNBytes,
char delimiter) |
static java.lang.String |
convertByteArrayToHexString(byte[] buffer,
int offset,
int length,
boolean addSpaceSeparator,
int addDelimiterEverNBytes,
char delimiter) |
static byte[] |
convertByteCharSequenceToByteArray(java.lang.CharSequence string)
When converting between String chars and bytes, there's an implied
encoding to be used, dependent on the context and platform.
|
static java.lang.String |
convertStringObject(Library library,
StringObject stringObject)
Utility method for decrypting a String object found in a dictionary
as a plaing text.
|
static java.lang.String |
getContentAndReplaceInputStream(java.io.InputStream[] inArray,
boolean convertToHex) |
static java.lang.String |
getContentFromSeekableInput(SeekableInput in,
boolean convertToHex) |
static int |
numBytesToHoldBits(int numBits) |
static void |
printMemory(java.lang.String str) |
static int |
readIntWithVaryingBytesBE(java.io.InputStream in,
int numBytes) |
static long |
readLongWithVaryingBytesBE(java.io.InputStream in,
int numBytes) |
static boolean |
reflectGraphicsEnvironmentISHeadlessInstance(java.lang.Object graphicsEnvironment,
boolean defaultReturnIfNoMethod)
boolean java.awt.GraphicsEnvironment.isHeadless() does not exist in Java 1.3,
since it was introduced in Java 1.4, so we use reflection to call it,
if it exists.
|
static SeekableInput |
replaceInputStreamWithSeekableInput(java.io.InputStream in) |
static void |
setIntIntoByteArrayBE(int value,
byte[] buffer,
int offset)
Sets the value into the buffer, at the designated offset, using big-endian rules
Callers is responsible to ensure that value will fit into buffer, starting at offset
|
static void |
setShortIntoByteArrayBE(short value,
byte[] buffer,
int offset)
Sets the value into the buffer, at the designated offset, using big-endian rules
Callers is responsible to ensure that value will fit into buffer, starting at offset
|
static void |
writeInteger(java.io.OutputStream in,
int i)
Write the given int as a 4 byte integer to the given outputStream.
|
static void |
writeLong(java.io.OutputStream in,
long i)
Write the given int as a 8 byte long to the given outputStream.
|
public static void setIntIntoByteArrayBE(int value,
byte[] buffer,
int offset)
value - to be set into bufferbuffer - into which value is to be setoffset - into buffer which value is to be setpublic static void setShortIntoByteArrayBE(short value,
byte[] buffer,
int offset)
value - to be set into bufferbuffer - into which value is to be setoffset - into buffer which value is to be setpublic static long readLongWithVaryingBytesBE(java.io.InputStream in,
int numBytes)
throws java.io.IOException
in - InputStream to read fromnumBytes - number of bytes to read to make integral value from [0, 8]java.io.IOExceptionpublic static int readIntWithVaryingBytesBE(java.io.InputStream in,
int numBytes)
throws java.io.IOException
in - InputStream to read fromnumBytes - number of bytes to read to make integral value from [0, 4]java.io.IOExceptionpublic static void writeInteger(java.io.OutputStream in,
int i)
throws java.io.IOException
in - stream to write byte data to.i - integer to convert to bytes.java.io.IOException - write error.public static void writeLong(java.io.OutputStream in,
long i)
throws java.io.IOException
in - stream to write byte data to.i - long to convert to bytes.java.io.IOException - write error.public static java.lang.String convertByteArrayToHexString(byte[] buffer,
boolean addSpaceSeparator)
public static java.lang.String convertByteArrayToHexString(byte[] buffer,
boolean addSpaceSeparator,
int addDelimiterEverNBytes,
char delimiter)
public static java.lang.String convertByteArrayToHexString(byte[] buffer,
int offset,
int length,
boolean addSpaceSeparator,
int addDelimiterEverNBytes,
char delimiter)
public static boolean reflectGraphicsEnvironmentISHeadlessInstance(java.lang.Object graphicsEnvironment,
boolean defaultReturnIfNoMethod)
graphicsEnvironment - java.awt.GraphicsEnvironment to call isHeadless() ondefaultReturnIfNoMethod - Value to return if could not call graphicsEnvironment.isHeadless()public static java.lang.String getContentAndReplaceInputStream(java.io.InputStream[] inArray,
boolean convertToHex)
public static java.lang.String getContentFromSeekableInput(SeekableInput in, boolean convertToHex)
public static SeekableInput replaceInputStreamWithSeekableInput(java.io.InputStream in)
public static void printMemory(java.lang.String str)
public static int numBytesToHoldBits(int numBits)
public static byte[] convertByteCharSequenceToByteArray(java.lang.CharSequence string)
LiteralStringObject,
HexStringObject,
StandardEncryptionpublic static java.lang.String convertByteArrayToByteString(byte[] bytes)
LiteralStringObject,
HexStringObject,
StandardEncryptionpublic static java.lang.String convertStringObject(Library library, StringObject stringObject)
library - docoument library used for encryption handling.stringObject - string object to convert to string