/** * Gets the zone using a fixed offset amount. * * @param id the zone id * @param offset the offset in millis * @return the zone */ private static DateTimeZone fixedOffsetZone(String id, int offset) { if (offset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, null, offset, offset); }
/** * Gets the zone using a fixed offset amount. * * @param id the zone id * @param offset the offset in millis * @return the zone */ private static DateTimeZone fixedOffsetZone(String id, int offset) { if (offset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, null, offset, offset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
/** * Decodes a built DateTimeZone from the given stream, as encoded by * writeTo. * * @param in input stream to read encoded DateTimeZone from. * @param id time zone id to assign */ public static DateTimeZone readFrom(DataInput in, String id) throws IOException { switch (in.readUnsignedByte()) { case 'F': DateTimeZone fixed = new FixedDateTimeZone (id, in.readUTF(), (int)readMillis(in), (int)readMillis(in)); if (fixed.equals(DateTimeZone.UTC)) { fixed = DateTimeZone.UTC; } return fixed; case 'C': return CachedDateTimeZone.forZone(PrecalculatedZone.readFrom(in, id)); case 'P': return PrecalculatedZone.readFrom(in, id); default: throw new IOException("Invalid encoding"); } }
/** * Decodes a built DateTimeZone from the given stream, as encoded by * writeTo. * * @param in input stream to read encoded DateTimeZone from. * @param id time zone id to assign */ public static DateTimeZone readFrom(DataInput in, String id) throws IOException { switch (in.readUnsignedByte()) { case 'F': DateTimeZone fixed = new FixedDateTimeZone (id, in.readUTF(), (int)readMillis(in), (int)readMillis(in)); if (fixed.equals(DateTimeZone.UTC)) { fixed = DateTimeZone.UTC; } return fixed; case 'C': return CachedDateTimeZone.forZone(PrecalculatedZone.readFrom(in, id)); case 'P': return PrecalculatedZone.readFrom(in, id); default: throw new IOException("Invalid encoding"); } }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
/** * Gets the zone using a fixed offset amount. * * @param id the zone id * @param offset the offset in millis * @return the zone */ private static synchronized DateTimeZone fixedOffsetZone(String id, int offset) { if (offset == 0) { return DateTimeZone.UTC; } if (iFixedOffsetCache == null) { iFixedOffsetCache = new HashMap<String, SoftReference<DateTimeZone>>(); } DateTimeZone zone; Reference<DateTimeZone> ref = iFixedOffsetCache.get(id); if (ref != null) { zone = ref.get(); if (zone != null) { return zone; } } zone = new FixedDateTimeZone(id, null, offset, offset); iFixedOffsetCache.put(id, new SoftReference<DateTimeZone>(zone)); return zone; }
/** * Decodes a built DateTimeZone from the given stream, as encoded by * writeTo. * * @param in input stream to read encoded DateTimeZone from. * @param id time zone id to assign */ public static DateTimeZone readFrom(DataInput in, String id) throws IOException { switch (in.readUnsignedByte()) { case 'F': DateTimeZone fixed = new FixedDateTimeZone (id, in.readUTF(), (int)readMillis(in), (int)readMillis(in)); if (fixed.equals(DateTimeZone.UTC)) { fixed = DateTimeZone.UTC; } return fixed; case 'C': return CachedDateTimeZone.forZone(PrecalculatedZone.readFrom(in, id)); case 'P': return PrecalculatedZone.readFrom(in, id); default: throw new IOException("Invalid encoding"); } }
public static final DateTimeZone UTC = new FixedDateTimeZone("UTC", "UTC", 0, 0);
/** * Gets the zone using a fixed offset amount. * * @param id the zone id * @param offset the offset in millis * @return the zone */ private static DateTimeZone fixedOffsetZone(String id, int offset) { if (offset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, null, offset, offset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone buildFixedZone(String id, String nameKey, int wallOffset, int standardOffset) { if ("UTC".equals(id) && id.equals(nameKey) && wallOffset == 0 && standardOffset == 0) { return DateTimeZone.UTC; } return new FixedDateTimeZone(id, nameKey, wallOffset, standardOffset); }
private static DateTimeZone timeZoneWithOffset(String zoneName, int offset) { if (zoneName.isEmpty()) { return DateTimeZone.forOffsetMillis(offset); } else { return new FixedDateTimeZone(zoneName, null, offset, offset); } }
private static DateTimeZone timeZoneWithOffset(String zoneName, int offset) { if (zoneName.isEmpty()) { return DateTimeZone.forOffsetMillis(offset); } else { return new FixedDateTimeZone(zoneName, null, offset, offset); } }