Class ByteUtils

java.lang.Object
com.itextpdf.io.source.ByteUtils

public final class ByteUtils extends Object
Converts strings and numbers to ISO-8859-1 compatible byte representations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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[]
    Converts each character in a string to its low byte.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ByteUtils

      public ByteUtils()
  • Method Details

    • getIsoBytes

      public static byte[] getIsoBytes (String text)
      Converts each character in a string to its low byte.
      Parameters:
      text - the text to convert
      Returns:
      a new byte array, or null when text is null
    • getIsoBytes

      public static byte[] getIsoBytes (byte pre, String text)
      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 null when text is null
    • getIsoBytes

      public static byte[] getIsoBytes (byte pre, String text, byte post)
      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 null when text is null
    • 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