public TimeZone makeTimeZone(String id) throws IOException { return makeTimeZone(id, true); }
public TimeZone makeTimeZone(String id) throws IOException { return makeTimeZone(id, true); }
public String[] getAvailableIDs(int rawOffset) { List<String> matches = new ArrayList<String>(); // Unfortunately we need load each ZoneInfo to determine the offset for (String id : ids) { try { TimeZone timeZone = makeTimeZone(id, false); if (timeZone.getRawOffset() == rawOffset) { matches.add(id); } } catch (IOException e) { } } return matches.toArray(new String[matches.size()]); }
public String[] getAvailableIDs(int rawOffset) { List<String> matches = new ArrayList<String>(); // Unfortunately we need load each ZoneInfo to determine the offset for (String id : ids) { try { TimeZone timeZone = makeTimeZone(id, false); if (timeZone.getRawOffset() == rawOffset) { matches.add(id); } } catch (IOException e) { } } return matches.toArray(new String[matches.size()]); }
private TimeZone makeTimeZone(String id, boolean clone) throws IOException { // Check the aliases first String realId = deprecatedAliases.get(id); if (realId != null) { return makeTimeZone(realId, clone); } // Work out where in the big data file this time zone is. int index = Arrays.binarySearch(ids, id); if (index < 0) { return null; } ZoneInfo zoneInfo = zoneInfos[index]; if (zoneInfo != null) { return clone ? (TimeZone) zoneInfo.clone() : zoneInfo; } byte[] bytes = IoUtils.readFileAsByteArray(ZONE_DIRECTORY_NAME + id); BufferIterator it = HeapBufferIterator.iterator(bytes, 0, bytes.length, ByteOrder.BIG_ENDIAN); zoneInfo = (ZoneInfo) ZoneInfo.makeTimeZone(id, it); zoneInfos[index] = zoneInfo; return clone ? (TimeZone) zoneInfo.clone() : zoneInfo; }
private TimeZone makeTimeZone(String id, boolean clone) throws IOException { // Check the aliases first String realId = deprecatedAliases.get(id); if (realId != null) { return makeTimeZone(realId, clone); } // Work out where in the big data file this time zone is. int index = Arrays.binarySearch(ids, id); if (index < 0) { return null; } ZoneInfo zoneInfo = zoneInfos[index]; if (zoneInfo != null) { return clone ? (TimeZone) zoneInfo.clone() : zoneInfo; } byte[] bytes = IoUtils.readFileAsByteArray(ZONE_DIRECTORY_NAME + id); BufferIterator it = HeapBufferIterator.iterator(bytes, 0, bytes.length, ByteOrder.BIG_ENDIAN); zoneInfo = (ZoneInfo) ZoneInfo.makeTimeZone(id, it); zoneInfos[index] = zoneInfo; return clone ? (TimeZone) zoneInfo.clone() : zoneInfo; }