Class BinaryValue
- java.lang.Object
-
- com.github.robtimus.os.windows.registry.RegistryValue
-
- com.github.robtimus.os.windows.registry.SettableRegistryValue
-
- com.github.robtimus.os.windows.registry.BinaryValue
-
public final class BinaryValue extends SettableRegistryValue
A representation of binary registry values. Instances of this class are immutable.- Author:
- Rob Spoor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.robtimus.os.windows.registry.RegistryValue
RegistryValue.Filter
-
-
Field Summary
-
Fields inherited from class com.github.robtimus.os.windows.registry.RegistryValue
DEFAULT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
data()
Returns the registry value's binary data.boolean
equals(Object o)
int
hashCode()
InputStream
inputStream()
Returns an input stream over the registry value's binary data.static BinaryValue
of(String name, byte[] data)
Creates a new binary registry value.static BinaryValue
of(String name, InputStream data)
Creates a new binary registry value.String
toString()
BinaryValue
withData(byte[] data)
Returns a registry value with the same name as this registry value but different binary data.BinaryValue
withData(InputStream data)
Returns a registry value with the same name as this registry value but different binary data.BinaryValue
withName(String name)
Returns a registry value with the same value as this registry value but a different name.-
Methods inherited from class com.github.robtimus.os.windows.registry.RegistryValue
filter, name
-
-
-
-
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 isnull
.
-
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 isnull
.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 classSettableRegistryValue
- 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 isnull
.
-
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.
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classRegistryValue
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classRegistryValue
-
-