Class BinaryValue


  • public final class BinaryValue
    extends SettableRegistryValue
    A representation of binary registry values. Instances of this class are immutable.
    Author:
    Rob Spoor
    • Method Detail

      • of

        public static BinaryValue of​(String name,
                                     byte[] data)
        Creates a new binary registry value.
        Parameters:
        name - The name of the registry value.
        data - The registry value's binary data.
        Returns:
        The created binary registry value.
        Throws:
        NullPointerException - If the given name or byte array is null.
      • of

        public static BinaryValue of​(String name,
                                     InputStream data)
                              throws IOException
        Creates a new binary registry value.
        Parameters:
        name - The name of the registry value.
        data - An input stream with the registry value's binary data.
        Returns:
        The created binary registry value.
        Throws:
        NullPointerException - If the given name or input stream is null.
        IOException - If an I/O error occurs while reading from the given input stream.
      • data

        public byte[] data()
        Returns the registry value's binary data.
        Returns:
        A copy of the registry value's binary data.
      • inputStream

        public InputStream inputStream()
        Returns an input stream over the registry value's binary data.
        Returns:
        An input stream over the registry value's binary data.
      • withName

        public BinaryValue withName​(String name)
        Description copied from class: SettableRegistryValue
        Returns a registry value with the same value as this registry value but a different name.
        Specified by:
        withName in class SettableRegistryValue
        Parameters:
        name - The name of the registry value to return.
        Returns:
        A registry value with the same value as this registry value and the given name.
      • withData

        public BinaryValue withData​(byte[] data)
        Returns a registry value with the same name as this registry value but different binary data.
        Parameters:
        data - The binary data of the registry value to return.
        Returns:
        A registry value with the same name as this registry value and the given binary data.
        Throws:
        NullPointerException - If the given array is null.
      • withData

        public BinaryValue withData​(InputStream data)
                             throws IOException
        Returns a registry value with the same name as this registry value but different binary data.
        Parameters:
        data - An input stream with the binary data of the registry value to return.
        Returns:
        A registry value with the same name as this registry value and the binary data from the given input stream.
        Throws:
        IOException - If an I/O error occurs while reading from the given input stream.