com.moyosoft.connector.registry
Class RegistryValue

java.lang.Object
  |
  +--com.moyosoft.connector.registry.RegistryValue

public class RegistryValue
extends java.lang.Object


Field Summary
static int REG_BINARY
           
static int REG_DWORD
           
static int REG_DWORD_BIG_ENDIAN
           
static int REG_EXPAND_SZ
           
static int REG_LINK
           
static int REG_NONE
           
static int REG_QWORD
           
static int REG_SZ
           
 
Constructor Summary
RegistryValue(byte[] binaryData)
          Creates a registry value for the specified binary data.
RegistryValue(int value)
          Creates a registry value for the specified integer.
RegistryValue(int type, byte[] data)
          Creates a registry value object with the specified raw data.
RegistryValue(long value)
          Creates a registry value for the specified long.
RegistryValue(java.lang.String value)
          Creates a registry value for the specified string.
RegistryValue(java.lang.String value, boolean containsEnvironmentVariables)
          Creates a registry value for the specified string.
 
Method Summary
 java.lang.String getAsString()
          Returns a formatted string of this registry value for all types.
 byte[] getBinaryData()
          Returns the binary data of this registry value.
 int getInteger()
          Returns the integer value of this registry value for the types REG_DWORD and REG_DWORD_BIG_ENDIAN.
 long getLong()
          Returns the long value of this registry value for the type REG_QWORD.
 byte[] getRawData()
          Returns the raw data of this value.
 java.lang.String getString()
          Returns the string value of this registry value for the types REG_SZ, REG_EXPAND_SZ and REG_LINK.
 int getType()
          Returns the type (REG_SZ, REG_BINARY, REG_DWORD, etc.) of this registry value object.
 boolean isBinary()
          Returns true if this registry value is a binary type (REG_BINARY).
 boolean isInteger()
          Returns true if this registry value type is an integer (REG_DWORD).
 boolean isLong()
          Returns true if this registry value type is a long (REG_QWORD).
 boolean isString()
          Returns true if this registry value type is a String (REG_SZ or REG_EXPAND_SZ).
 boolean isSymbolicLink()
          Returns true if this registry value type is a Symbolic link (REG_LINK).
 java.lang.String toString()
          Returns a formatted string of this registry value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REG_NONE

public static final int REG_NONE
See Also:
Constant Field Values

REG_SZ

public static final int REG_SZ
See Also:
Constant Field Values

REG_EXPAND_SZ

public static final int REG_EXPAND_SZ
See Also:
Constant Field Values

REG_BINARY

public static final int REG_BINARY
See Also:
Constant Field Values

REG_DWORD

public static final int REG_DWORD
See Also:
Constant Field Values

REG_DWORD_BIG_ENDIAN

public static final int REG_DWORD_BIG_ENDIAN
See Also:
Constant Field Values

REG_LINK

public static final int REG_LINK
See Also:
Constant Field Values

REG_QWORD

public static final int REG_QWORD
See Also:
Constant Field Values
Constructor Detail

RegistryValue

public RegistryValue(int type,
                     byte[] data)
Creates a registry value object with the specified raw data.

Example:
new RegistryValue(RegistryValue.REG_BINARY, new byte[] {0x01, 0x02, 0x03});

Parameters:
type - The type of the value (REG_SZ, REG_BINARY or REG_DWORD).
data - The raw data of the value. Strings' (REG_SZ) data use the UTF-16LE character encoding.

RegistryValue

public RegistryValue(java.lang.String value)
Creates a registry value for the specified string. The value type is set to REG_SZ.


RegistryValue

public RegistryValue(java.lang.String value,
                     boolean containsEnvironmentVariables)
Creates a registry value for the specified string. The value type is set to REG_SZ or REG_EXPAND_SZ.

Parameters:
value - the actual String value
containsEnvironmentVariables - if true the type REG_EXPAND_SZ is used; otherwise REG_SZ type is used.

RegistryValue

public RegistryValue(byte[] binaryData)
Creates a registry value for the specified binary data. The value type is set to REG_BINARY.


RegistryValue

public RegistryValue(int value)
Creates a registry value for the specified integer. The value type is set to REG_DWORD.


RegistryValue

public RegistryValue(long value)
Creates a registry value for the specified long. The value type is set to REG_QWORD.

Method Detail

getType

public int getType()
Returns the type (REG_SZ, REG_BINARY, REG_DWORD, etc.) of this registry value object.


getRawData

public byte[] getRawData()
Returns the raw data of this value. Strings' (REG_SZ) data use the UTF-16LE character encoding.


isString

public boolean isString()
Returns true if this registry value type is a String (REG_SZ or REG_EXPAND_SZ). If this method returns true, the String value is accessible with the method getString().


isBinary

public boolean isBinary()
Returns true if this registry value is a binary type (REG_BINARY). If this method returns true, the binary data are accessible with the method getBinaryData().


isInteger

public boolean isInteger()
Returns true if this registry value type is an integer (REG_DWORD). If this method returns true, the integer value is accessible with the method getInteger().


isLong

public boolean isLong()
Returns true if this registry value type is a long (REG_QWORD). If this method returns true, the integer value is accessible with the method getLong().


isSymbolicLink

public boolean isSymbolicLink()
Returns true if this registry value type is a Symbolic link (REG_LINK). If this method returns true, the Symbolic link value is accessible with the method getString().


getString

public java.lang.String getString()
Returns the string value of this registry value for the types REG_SZ, REG_EXPAND_SZ and REG_LINK. If this registry value is of another type, this method returns null.


getBinaryData

public byte[] getBinaryData()
Returns the binary data of this registry value. If this registry value type is not REG_BINARY, this method returns null.


getInteger

public int getInteger()
Returns the integer value of this registry value for the types REG_DWORD and REG_DWORD_BIG_ENDIAN. If this registry value is of another type, this method returns 0.


getLong

public long getLong()
Returns the long value of this registry value for the type REG_QWORD. If this registry value is of another type, this method returns 0.


getAsString

public java.lang.String getAsString()
Returns a formatted string of this registry value for all types.
If the type is REG_SZ, REG_EXPAND_SZ or REG_LINK this method returns the same value as getString().
If the type is REG_BINARY this method returns the raw data formatted as hexadecimal bytes.
If the type is REG_DWORD or REG_DWORD_BIG_ENDIAN this method returns the integer value formatted as a signed decimal string.
If the type is REG_QWORD this method returns the long value formatted as a signed decimal string.


toString

public java.lang.String toString()
Returns a formatted string of this registry value. Same as getAsString().

Overrides:
toString in class java.lang.Object