com.syncbuilder.storage
Class Char4

java.lang.Object
  |
  +--com.syncbuilder.storage.Char4

public final class Char4
extends java.lang.Object

The representation of a 4-character identifier. These identifiers are needed for the Creator-IDs and the database types. They need special treatment, because they are 4-byte integers, where each byte is an 8-bit character for the sake of readability.

Instances of this class are immutable.


Constructor Summary
Char4(byte[] b)
          Create a Char4 from an array of 4 bytes.
Char4(int id)
          Create a Char4 from a 32-bit integer.
Char4(java.lang.String id)
          Create a Char4 from a String of 4 characters.
 
Method Summary
 boolean equals(Char4 other)
          Is the Char4 equal to another one?
 byte[] getBytes()
          Get the array of 4 bytes from the Char4.
 int getInt()
          Get the 32-bit integer-value of the Char4.
 java.lang.String getString()
          Get the 4-character String of the Char4.
 java.lang.String toString()
          Return the Char4's value as a pretty human-readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Char4

public Char4(int id)
Create a Char4 from a 32-bit integer.
Parameters:
id - the 32-bit integer

Char4

public Char4(java.lang.String id)
      throws java.lang.IllegalArgumentException
Create a Char4 from a String of 4 characters.
Parameters:
id - the String
Throws:
java.lang.IllegalArgumentException - The String is not 4 characters long

Char4

public Char4(byte[] b)
      throws java.lang.IllegalArgumentException
Create a Char4 from an array of 4 bytes.
Parameters:
id - the array
Throws:
java.lang.IllegalArgumentException - The array is not 4 bytes long
Method Detail

getInt

public int getInt()
Get the 32-bit integer-value of the Char4.

getBytes

public byte[] getBytes()
Get the array of 4 bytes from the Char4.

getString

public java.lang.String getString()
Get the 4-character String of the Char4.

equals

public boolean equals(Char4 other)
Is the Char4 equal to another one?

toString

public java.lang.String toString()
Return the Char4's value as a pretty human-readable string.
Overrides:
toString in class java.lang.Object


This material is Copyrighted (C) 1999 by Tilo Christ. All Rights Reserved.