@Override public void write(Object value, DataOutput dataOutput, IdentityRecordStack parentRecords) { dataOutput.writeLong((Long)value); }
@Override public void write(Object value, DataOutput dataOutput, IdentityRecordStack parentRecords) { dataOutput.writeByte((byte)1); // Encoding version 1 // Currently we only store the millis, not the chronology. dataOutput.writeLong(((DateTime)value).getMillis()); }
@Override public void serialize(Object value, DataOutput dataOutput) { DateTime dateTime = (DateTime) value; dateTime = dateTime.toDateTime(DateTimeZone.UTC); //store as UTC dataOutput.writeLong(dateTime.getMillis()); }
@Override public void writeBytes(DataOutput dataOutput) { if (uuidBytes == null) { dataOutput.writeByte(IdGeneratorImpl.IdType.UUID.getIdentifierByte()); dataOutput.writeLong(uuid.getMostSignificantBits()); dataOutput.writeLong(uuid.getLeastSignificantBits()); } else { dataOutput.writeBytes(uuidBytes); } }
@Override public void write(Object value, DataOutput dataOutput, IdentityRecordStack parentRecords) { dataOutput.writeByte((byte)1); // Encoding version 1 // Currently we only store the millis, not the chronology. dataOutput.writeLong(((LocalDate)value).toDateTimeAtStartOfDay(DateTimeZone.UTC).getMillis()); }
/** * Format of the bytes written : * - Length of the blob value : int of 4 bytes * - Blob Value * - Blob Media Type : UTF (which starts with an int of 4 bytes indicating its length) * - Blob size : long of 8 bytes * - Blob name : UTF (which starts with an int of 4 bytes indicating its length) * * <p> IMPORTANT: Any changes on this format has an impact on the {@link ContainsValueComparator} */ @Override public void write(Object value, DataOutput dataOutput, IdentityRecordStack parentRecords) { dataOutput.writeByte((byte)1); // Encoding version 1 Blob blob = (Blob)value; byte[] key = blob.getValue(); if (key == null) { dataOutput.writeVInt(0); } else { dataOutput.writeVInt(key.length); dataOutput.writeBytes(key); } dataOutput.writeUTF(blob.getMediaType()); Long size = blob.getSize(); if (size == null) { size = Long.valueOf(-1); } dataOutput.writeLong(size); dataOutput.writeUTF(blob.getName()); }
dataOutput.writeVInt(recordIdBytes.length); dataOutput.writeBytes(recordIdBytes); dataOutput.writeLong(recordType.getVersion());