org.apache.fop.afp.util

## Class BinaryUtils

- java.lang.Object
- - org.apache.fop.afp.util.BinaryUtils

-     public final class BinaryUtils
      extends Object

  Library of utility useful conversion methods.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `convert(int integer)` Convert an int into the corresponding byte array by encoding each two hexadecimal digits as a char.
    `static byte[]` | `convert(int integer, int bufsize)` Convert an int into the corresponding byte array by encoding each two hexadecimal digits as a char.
    `static byte[]` | `convert(String digits)` Convert a String of hexadecimal digits into the corresponding byte array by encoding each two hexadecimal digits as a byte.
    `static byte[]` | `shortToByteArray(short value)` Convert the specified short into a byte array.
    `static void` | `shortToByteArray(short value, byte[] array, int offset)` Convert the specified short into a byte array.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### convert

          public static byte[] convert(int integer,
                                       int bufsize)

      Convert an int into the corresponding byte array by encoding each two hexadecimal digits as a char. This will return a byte array to the length specified by bufsize.
      Parameters:
        `integer` - The int representation.
        `bufsize` - The required byte array size.
      Returns:
        the hexadecimal digits as a byte array

    - #### convert

          public static byte[] convert(int integer)

      Convert an int into the corresponding byte array by encoding each two hexadecimal digits as a char.
      Parameters:
        `integer` - The int representation
      Returns:
        the hexadecimal digits as a byte array

    - #### convert

          public static byte[] convert(String digits)

      Convert a String of hexadecimal digits into the corresponding byte array by encoding each two hexadecimal digits as a byte.
      Parameters:
        `digits` - The hexadecimal digits representation.
      Returns:
        the hexadecimal digits as a byte array

    - #### shortToByteArray

          public static void shortToByteArray(short value,
                                              byte[] array,
                                              int offset)

      Convert the specified short into a byte array.
      Parameters:
        `value` - The value to be converted.
        `array` - The array to receive the data.
        `offset` - The offset into the byte array for the start of the value.

    - #### shortToByteArray

          public static byte[] shortToByteArray(short value)

      Convert the specified short into a byte array.
      Parameters:
        `value` - The value to be converted.
      Returns:
        The byte array

Copyright © 2023 Apache Software Foundation. All rights reserved.