Package com.itextpdf.io.source
Class ByteUtils
java.lang.Object
com.itextpdf.io.source.ByteUtils
Converts strings and numbers to ISO-8859-1 compatible byte representations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]getIsoBytes(byte pre, String text) Converts a string to bytes and optionally prefixes it with a byte.static byte[]getIsoBytes(byte pre, String text, byte post) Converts a string to bytes and optionally surrounds it with bytes.static byte[]getIsoBytes(double d) Formats a floating-point value as ISO-8859-1 compatible decimal bytes.static byte[]getIsoBytes(int n) Formats an integer as ISO-8859-1 compatible decimal bytes.static byte[]getIsoBytes(String text) Converts each character in a string to its low byte.
-
Constructor Details
-
ByteUtils
public ByteUtils()
-
-
Method Details
-
getIsoBytes
Converts each character in a string to its low byte.- Parameters:
-
text- the text to convert - Returns:
-
a new byte array, or
nullwhentextisnull
-
getIsoBytes
Converts a string to bytes and optionally prefixes it with a byte.- Parameters:
-
pre- the prefix byte; zero omits the prefix -
text- the text to convert - Returns:
-
a new byte array, or
nullwhentextisnull
-
getIsoBytes
Converts a string to bytes and optionally surrounds it with bytes.- Parameters:
-
pre- the prefix byte; zero omits the prefix -
text- the text to convert -
post- the suffix byte; zero omits the suffix - Returns:
-
a new byte array, or
nullwhentextisnull
-
getIsoBytes
public static byte[] getIsoBytes(int n) Formats an integer as ISO-8859-1 compatible decimal bytes.- Parameters:
-
n- the integer to format - Returns:
- the decimal representation
-
getIsoBytes
public static byte[] getIsoBytes(double d) Formats a floating-point value as ISO-8859-1 compatible decimal bytes.- Parameters:
-
d- the value to format - Returns:
- the decimal representation using the current global precision setting
-