Inheritance diagram for edu.virtualschool.jco.JCOGenericBytes:

Definition at line 12 of file JCOGenericBytes.java.
Public Member Functions | |
| JCOGenericBytes (byte[] bytes) | |
| boolean | equals (Object o) |
| int | hashCode () |
| final byte[] | getBytes () |
Static Public Member Functions | |
| final boolean | isEqualBytes (byte[] b1, byte[] b2) |
Package Functions | |
| JCOGenericBytes (Serializable object) throws JCOFault | |
Package Attributes | |
| final byte[] | bytes |
| The repository as a byte[] array. | |
Static Package Attributes | |
| final long | serialVersionUID = -3017285087236141065L |
|
|
Construct a repository with the specified byte[] contents.
Definition at line 21 of file JCOGenericBytes.java.
00022 {
00023 this.bytes = bytes;
00024 }
|
|
|
Construct a repository by serializing the provided object
Definition at line 30 of file JCOGenericBytes.java.
00031 {
00032 try
00033 {
00034 ByteArrayOutputStream bos = new ByteArrayOutputStream();
00035 ObjectOutputStream oos = new ObjectOutputStream(bos);
00036 oos.writeObject(object);
00037 oos.close();
00038 this.bytes = bos.toByteArray();
00039 }
00040 catch (IOException e)
00041 {
00042 throw new JCOFault(e, e);
00043 }
00044 }
|
|
|
Implement Object.equals: two JCOBytes are equal iff they have the same contents. Definition at line 49 of file JCOGenericBytes.java. References edu.virtualschool.jco.JCOGenericBytes.bytes, and edu.virtualschool.jco.JCOGenericBytes.isEqualBytes().
00050 {
00051 if (o instanceof JCOGenericBytes)
00052 {
00053 JCOGenericBytes that = (JCOGenericBytes)o;
00054 return isEqualBytes(bytes, that.bytes);
00055 }
00056 else
00057 return o == this;
00058 }
|
|
|
Retrive the contents of this receiver.
Definition at line 91 of file JCOGenericBytes.java. References edu.virtualschool.jco.JCOGenericBytes.bytes. Referenced by edu.virtualschool.jco.JCODigestedBytes.encode().
00092 {
00093 return bytes;
00094 }
|
|
|
Override Object.hashCode() to be consistent with JCOBytes.equals(). Definition at line 80 of file JCOGenericBytes.java. References edu.virtualschool.jco.JCOGenericBytes.bytes.
|
|
||||||||||||
|
Byte comparison utility used by the test cases
Definition at line 65 of file JCOGenericBytes.java. Referenced by edu.virtualschool.jco.JCOGenericBytes.equals().
00066 {
00067 if (b1.length != b2.length)
00068 return false;
00069
00070 for (int i = 0; i < b1.length; i++)
00071 if (b1[i] != b2[i])
00072 return false;
00073
00074 return true;
00075 }
|