/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * Loads the time zone data for one id. * * @param id the id to load * @return the zone */ private DateTimeZone loadZoneData(String id) { InputStream in = null; try { in = openResource(id); DateTimeZone tz = DateTimeZoneBuilder.readFrom(in, id); iZoneInfoMap.put(id, new SoftReference<DateTimeZone>(tz)); return tz; } catch (IOException ex) { uncaughtException(ex); iZoneInfoMap.remove(id); return null; } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { } } }
/** * Loads the time zone data for one id. * * @param id the id to load * @return the zone */ private DateTimeZone loadZoneData(String id) { InputStream in = null; try { in = openResource(id); DateTimeZone tz = DateTimeZoneBuilder.readFrom(in, id); iZoneInfoMap.put(id, new SoftReference<DateTimeZone>(tz)); return tz; } catch (IOException ex) { uncaughtException(ex); iZoneInfoMap.remove(id); return null; } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { } } }
private void writeZone(File outputDir, DateTimeZoneBuilder builder, DateTimeZone tz) throws IOException { if (ZoneInfoLogger.verbose()) { System.out.println("Writing " + tz.getID()); } File file = new File(outputDir, tz.getID()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } OutputStream out = new FileOutputStream(file); try { builder.writeTo(tz.getID(), out); } finally { out.close(); } // Test if it can be read back. InputStream in = new FileInputStream(file); DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID()); in.close(); if (!tz.equals(tz2)) { System.out.println("*e* Error in " + tz.getID() + ": Didn't read properly from file"); } }
/** * Loads the time zone data for one id. * * @param id the id to load * @return the zone */ private DateTimeZone loadZoneData(String id) { InputStream in = null; try { in = openResource(id); DateTimeZone tz = DateTimeZoneBuilder.readFrom(in, id); iZoneInfoMap.put(id, new SoftReference<DateTimeZone>(tz)); return tz; } catch (IOException ex) { uncaughtException(ex); iZoneInfoMap.remove(id); return null; } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { } } }
private void writeZone(File outputDir, DateTimeZoneBuilder builder, DateTimeZone tz) throws IOException { if (ZoneInfoLogger.verbose()) { System.out.println("Writing " + tz.getID()); } File file = new File(outputDir, tz.getID()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } OutputStream out = new FileOutputStream(file); try { builder.writeTo(tz.getID(), out); } finally { out.close(); } // Test if it can be read back. InputStream in = new FileInputStream(file); DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID()); in.close(); if (!tz.equals(tz2)) { System.out.println("*e* Error in " + tz.getID() + ": Didn't read properly from file"); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * Loads the time zone data for one id. * * @param id the id to load * @return the zone */ private DateTimeZone loadZoneData(String id) { InputStream in = null; try { in = openResource(id); DateTimeZone tz = DateTimeZoneBuilder.readFrom(in, id); iZoneInfoMap.put(id, new SoftReference<DateTimeZone>(tz)); return tz; } catch (IOException ex) { uncaughtException(ex); iZoneInfoMap.remove(id); return null; } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { } } }
DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID()); in.close();
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
/** * 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(InputStream in, String id) throws IOException { if (in instanceof DataInput) { return readFrom((DataInput)in, id); } else { return readFrom((DataInput)new DataInputStream(in), id); } }
private void writeZone(File outputDir, DateTimeZoneBuilder builder, DateTimeZone tz) throws IOException { if (ZoneInfoLogger.verbose()) { System.out.println("Writing " + tz.getID()); } File file = new File(outputDir, tz.getID()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } OutputStream out = new FileOutputStream(file); try { builder.writeTo(tz.getID(), out); } finally { out.close(); } // Test if it can be read back. InputStream in = new FileInputStream(file); DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID()); in.close(); if (!tz.equals(tz2)) { System.out.println("*e* Error in " + tz.getID() + ": Didn't read properly from file"); } }
private void writeZone(File outputDir, DateTimeZoneBuilder builder, DateTimeZone tz) throws IOException { if (ZoneInfoLogger.verbose()) { System.out.println("Writing " + tz.getID()); } File file = new File(outputDir, tz.getID()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } OutputStream out = new FileOutputStream(file); try { builder.writeTo(tz.getID(), out); } finally { out.close(); } // Test if it can be read back. InputStream in = new FileInputStream(file); DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID()); in.close(); if (!tz.equals(tz2)) { System.out.println("*e* Error in " + tz.getID() + ": Didn't read properly from file"); } }