/** * Uses a serialization delegate. * * @return the replacing object, not null */ private Object writeReplace() { return new Ser(Ser.ZOTRULE, this); }
static Object read(DataInput in) throws IOException, ClassNotFoundException { byte type = in.readByte(); return readInternal(type, in); }
/** * Writes the state to the stream. * * @param out the output stream, not null * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { Ser.writeEpochSec(toEpochSecond(), out); Ser.writeOffset(offsetBefore, out); Ser.writeOffset(offsetAfter, out); }
/** * Reads the state from the stream. * * @param in the input stream, not null * @return the created object, not null * @throws IOException if an error occurs */ static ZoneOffsetTransition readExternal(DataInput in) throws IOException { long epochSecond = Ser.readEpochSec(in); ZoneOffset before = Ser.readOffset(in); ZoneOffset after = Ser.readOffset(in); if (before.equals(after)) { throw new IllegalArgumentException("Offsets must not be equal"); } return new ZoneOffsetTransition(epochSecond, before, after); }
/** * Implements the {@code Externalizable} interface to write the object. * * @param out the data stream to write to, not null */ public void writeExternal(ObjectOutput out) throws IOException { writeInternal(type, object, out); }
ZoneRules createRule(short index) throws Exception { Object obj = ruleData.get(index); if (obj instanceof byte[]) { byte[] bytes = (byte[]) obj; DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); obj = Ser.read(dis); ruleData.set(index, obj); } return (ZoneRules) obj; }
baos.reset(); DataOutputStream dataos = new DataOutputStream(baos); Ser.write(rules, dataos); dataos.close(); byte[] bytes = baos.toByteArray();
/** * Reads the state from the stream. * * @param in the input stream, not null * @return the created object, not null * @throws IOException if an error occurs */ static ZoneOffsetTransition readExternal(DataInput in) throws IOException { long epochSecond = Ser.readEpochSec(in); ZoneOffset before = Ser.readOffset(in); ZoneOffset after = Ser.readOffset(in); if (before.equals(after)) { throw new IllegalArgumentException("Offsets must not be equal"); } return new ZoneOffsetTransition(epochSecond, before, after); }
/** * Implements the {@code Externalizable} interface to write the object. * * @param out the data stream to write to, not null */ public void writeExternal(ObjectOutput out) throws IOException { writeInternal(type, object, out); }
ZoneRules createRule(short index) throws Exception { Object obj = ruleData.get(index); if (obj instanceof byte[]) { byte[] bytes = (byte[]) obj; DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); obj = Ser.read(dis); ruleData.set(index, obj); } return (ZoneRules) obj; }
baos.reset(); DataOutputStream dataos = new DataOutputStream(baos); Ser.write(rules, dataos); dataos.close(); byte[] bytes = baos.toByteArray();
/** * Writes the state to the stream. * * @param out the output stream, not null * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { Ser.writeEpochSec(toEpochSecond(), out); Ser.writeOffset(offsetBefore, out); Ser.writeOffset(offsetAfter, out); }
long[] stdTrans = new long[stdSize]; for (int i = 0; i < stdSize; i++) { stdTrans[i] = Ser.readEpochSec(in); stdOffsets[i] = Ser.readOffset(in); savTrans[i] = Ser.readEpochSec(in); savOffsets[i] = Ser.readOffset(in);
/** * Uses a serialization delegate. * * @return the replacing object, not null */ private Object writeReplace() { return new Ser(Ser.SZR, this); }
static Object read(DataInput in) throws IOException, ClassNotFoundException { byte type = in.readByte(); return readInternal(type, in); }
static void write(Object object, DataOutput out) throws IOException { writeInternal(SZR, object, out); }
/** * Writes the state to the stream. * * @param out the output stream, not null * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { out.writeInt(standardTransitions.length); for (long trans : standardTransitions) { Ser.writeEpochSec(trans, out); } for (ZoneOffset offset : standardOffsets) { Ser.writeOffset(offset, out); } out.writeInt(savingsInstantTransitions.length); for (long trans : savingsInstantTransitions) { Ser.writeEpochSec(trans, out); } for (ZoneOffset offset : wallOffsets) { Ser.writeOffset(offset, out); } out.writeByte(lastRules.length); for (ZoneOffsetTransitionRule rule : lastRules) { rule.writeExternal(out); } }
long[] stdTrans = new long[stdSize]; for (int i = 0; i < stdSize; i++) { stdTrans[i] = Ser.readEpochSec(in); stdOffsets[i] = Ser.readOffset(in); savTrans[i] = Ser.readEpochSec(in); savOffsets[i] = Ser.readOffset(in);
/** * Uses a serialization delegate. * * @return the replacing object, not null */ private Object writeReplace() { return new Ser(Ser.ZOTRULE, this); }
/** * Implements the {@code Externalizable} interface to read the object. * * @param in the data to read, not null */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { type = in.readByte(); object = readInternal(type, in); }