@Override public boolean equals(Object object) { if ((object == null) || !(object instanceof SimpleMarshalledValue)) return false; @SuppressWarnings("unchecked") SimpleMarshalledValue<T> value = (SimpleMarshalledValue<T>) object; if ((this.object != null) && (value.object != null)) { return this.object.equals(value.object); } try { byte[] us = this.getBytes(); byte[] them = value.getBytes(); return ((us != null) && (them != null)) ? Arrays.equals(us, them) : (us == them); } catch (IOException e) { throw new IllegalStateException(e); } }
@Override public void writeObject(ObjectOutput output, SimpleMarshalledValue<T> object) throws IOException { byte[] bytes = object.getBytes(); IndexSerializer.VARIABLE.writeInt(output, (bytes != null) ? bytes.length : 0); if (bytes != null) { output.write(bytes); } }
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); byte[] bytes = this.getBytes(); if (bytes != null) { out.writeInt(bytes.length); out.write(bytes); } else { out.writeInt(0); } }
@Override public HashableMarshalledValue<T> readObject(ObjectInput input) throws IOException, ClassNotFoundException { SimpleMarshalledValue<T> value = this.externalizer.readObject(input); int hashCode = input.readInt(); return new HashableMarshalledValue<>(value.getBytes(), hashCode); }
@Override public boolean equals(Object object) { if ((object == null) || !(object instanceof SimpleMarshalledValue)) return false; @SuppressWarnings("unchecked") SimpleMarshalledValue<T> value = (SimpleMarshalledValue<T>) object; if ((this.object != null) && (value.object != null)) { return this.object.equals(value.object); } try { byte[] us = this.getBytes(); byte[] them = value.getBytes(); return ((us != null) && (them != null)) ? Arrays.equals(us, them) : (us == them); } catch (IOException e) { throw new IllegalStateException(e); } }
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); byte[] bytes = this.getBytes(); if (bytes != null) { out.writeInt(bytes.length); out.write(bytes); } else { out.writeInt(0); } }
@Override public void writeObject(ObjectOutput output, SimpleMarshalledValue<T> object) throws IOException { byte[] bytes = object.getBytes(); IndexSerializer.VARIABLE.writeInt(output, (bytes != null) ? bytes.length : 0); if (bytes != null) { output.write(bytes); } }
@Override public HashableMarshalledValue<T> readObject(ObjectInput input) throws IOException, ClassNotFoundException { SimpleMarshalledValue<T> value = this.externalizer.readObject(input); int hashCode = input.readInt(); return new HashableMarshalledValue<>(value.getBytes(), hashCode); }