home *** CD-ROM | disk | FTP | other *** search
- package java.rmi;
-
- import java.io.ByteArrayInputStream;
- import java.io.ByteArrayOutputStream;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
-
- public final class MarshalledObject implements Serializable {
- private byte[] objBytes = null;
- private byte[] locBytes = null;
- private int hash;
- private static final long serialVersionUID = 8988374069173025854L;
-
- public MarshalledObject(Object var1) throws IOException {
- if (var1 == null) {
- this.hash = 13;
- } else {
- ByteArrayOutputStream var2 = new ByteArrayOutputStream();
- ByteArrayOutputStream var3 = new ByteArrayOutputStream();
- MarshalledObjectOutputStream var4 = new MarshalledObjectOutputStream(var2, var3);
- ((ObjectOutputStream)var4).writeObject(var1);
- var4.flush();
- this.objBytes = var2.toByteArray();
- this.locBytes = var4.hadAnnotations() ? var3.toByteArray() : null;
- int var5 = 0;
-
- for(int var6 = 0; var6 < this.objBytes.length; ++var6) {
- var5 = 31 * var5 + this.objBytes[var6];
- }
-
- this.hash = var5;
- }
- }
-
- public Object get() throws IOException, ClassNotFoundException {
- if (this.objBytes == null) {
- return null;
- } else {
- ByteArrayInputStream var1 = new ByteArrayInputStream(this.objBytes);
- ByteArrayInputStream var2 = this.locBytes == null ? null : new ByteArrayInputStream(this.locBytes);
- MarshalledObjectInputStream var3 = new MarshalledObjectInputStream(var1, var2);
- return ((ObjectInputStream)var3).readObject();
- }
- }
-
- public int hashCode() {
- return this.hash;
- }
-
- public boolean equals(Object var1) {
- if (var1 == this) {
- return true;
- } else if (var1 != null && var1 instanceof MarshalledObject) {
- MarshalledObject var2 = (MarshalledObject)var1;
- if (this.objBytes != null && var2.objBytes != null) {
- if (this.objBytes.length != var2.objBytes.length) {
- return false;
- } else {
- for(int var3 = 0; var3 < this.objBytes.length; ++var3) {
- if (this.objBytes[var3] != var2.objBytes[var3]) {
- return false;
- }
- }
-
- return true;
- }
- } else {
- return this.objBytes == var2.objBytes;
- }
- } else {
- return false;
- }
- }
- }
-