void writeExternal(DataOutput out) throws IOException { final int offsetSecs = totalSeconds; int offsetByte = offsetSecs % 900 == 0 ? offsetSecs / 900 : 127; // compress to -72 to +72 out.writeByte(offsetByte); if (offsetByte == 127) { out.writeInt(offsetSecs); } }
@Override void write(DataOutput out) throws IOException { out.writeByte(Ser.ZONE_OFFSET_TYPE); writeExternal(out); }