Tabnine Logo
org.threeten.bp.zone
Code IndexAdd Tabnine to your IDE (free)

How to use org.threeten.bp.zone

Best Java code snippets using org.threeten.bp.zone (Showing top 20 results out of 315)

origin: JakeWharton/ThreeTenABP

 @Override protected void initializeProviders() {
  TzdbZoneRulesProvider provider;

  InputStream is = null;
  try {
   is = context.getAssets().open("org/threeten/bp/TZDB.dat");
   provider = new TzdbZoneRulesProvider(is);
  } catch (IOException e) {
   throw new IllegalStateException("TZDB.dat missing from assets.", e);
  } finally {
   if (is != null) {
    try {
     is.close();
    } catch (IOException ignored) {
    }
   }
  }

  ZoneRulesProvider.registerProvider(provider);
 }
}
origin: JakeWharton/ThreeTenABP

public static void init(Context context) {
 if (!initialized.getAndSet(true)) {
  ZoneRulesInitializer.setInitializer(new AssetsZoneRulesInitializer(context));
 }
}
origin: JakeWharton/ThreeTenABP

 @Test public void litmus() {
  AndroidThreeTen.init(context);
  assertThat(ZoneRulesProvider.getAvailableZoneIds()).isNotEmpty();
 }
}
origin: ThreeTen/threetenbp

private static Object readInternal(byte type, DataInput in) throws IOException, ClassNotFoundException {
  switch (type) {
    case SZR:
      return StandardZoneRules.readExternal(in);
    case ZOT:
      return ZoneOffsetTransition.readExternal(in);
    case ZOTRULE:
      return ZoneOffsetTransitionRule.readExternal(in);
    default:
      throw new StreamCorruptedException("Unknown serialized type");
  }
}
origin: ThreeTen/threetenbp

@Override
public ZoneOffset getOffset(LocalDateTime localDateTime) {
  Object info = getOffsetInfo(localDateTime);
  if (info instanceof ZoneOffsetTransition) {
    return ((ZoneOffsetTransition) info).getOffsetBefore();
  }
  return (ZoneOffset) info;
}
origin: ThreeTen/threetenbp

/**
 * 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);
}
origin: ThreeTen/threetenbp

@Override
public ZoneRules getRules() {
  // additional query for group provider when null allows for possibility
  // that the provider was added after the ZoneId was created
  return (rules != null ? rules : ZoneRulesProvider.getRules(id, false));
}
origin: ThreeTen/threetenbp

  void addToBuilder(ZoneRulesBuilder bld) {
    adjustToFowards(2004);  // irrelevant, treat as leap year
    bld.addRuleToWindow(startYear, endYear, month, dayOfMonth, dayOfWeek, time, adjustDays, timeDefinition, savingsAmount);
  }
}
origin: stackoverflow.com

 ZoneId zoneId = ZoneId.of("Australia/Sydney");
ZoneRules rules = zoneId.getRules();

ZoneOffsetTransition nextTransition = rules.nextTransition(Instant.now());
System.out.println("Next transition at: " +
    nextTransition.getInstant().atZone(zoneId));

ZoneOffsetTransition nextNextTransition =
    rules.nextTransition(nextTransition.getInstant());
System.out.println("Next transition after that at: " +
    nextNextTransition.getInstant().atZone(zoneId));
origin: ThreeTen/threetenbp

/**
 * Parses the source files.
 *
 * @throws Exception if an error occurs
 */
private void parseFiles() throws Exception {
  for (File file : sourceFiles) {
    printVerbose("Parsing file: " + file);
    parseFile(file);
  }
}
origin: ThreeTen/threetenbp

/**
 * Uses a serialization delegate.
 *
 * @return the replacing object, not null
 */
private Object writeReplace() {
  return new Ser(Ser.ZOT, this);
}
origin: ThreeTen/threetenbp

@Override
public ZoneOffsetTransition getTransition(LocalDateTime localDateTime) {
  Object info = getOffsetInfo(localDateTime);
  return (info instanceof ZoneOffsetTransition ? (ZoneOffsetTransition) info : null);
}
origin: org.threeten/threetenbp

/**
 * Gets the associated time-zone rules.
 * <p>
 * The rules will always return this offset when queried.
 * The implementation class is immutable, thread-safe and serializable.
 *
 * @return the rules, not null
 */
@Override
public ZoneRules getRules() {
  return ZoneRules.of(this);
}
origin: org.threeten/threetenbp

/**
 * 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);
}
origin: org.threeten/threetenbp

private static Object readInternal(byte type, DataInput in) throws IOException, ClassNotFoundException {
  switch (type) {
    case SZR:
      return StandardZoneRules.readExternal(in);
    case ZOT:
      return ZoneOffsetTransition.readExternal(in);
    case ZOTRULE:
      return ZoneOffsetTransitionRule.readExternal(in);
    default:
      throw new StreamCorruptedException("Unknown serialized type");
  }
}
origin: org.threeten/threetenbp

@Override
public ZoneOffset getOffset(LocalDateTime localDateTime) {
  Object info = getOffsetInfo(localDateTime);
  if (info instanceof ZoneOffsetTransition) {
    return ((ZoneOffsetTransition) info).getOffsetBefore();
  }
  return (ZoneOffset) info;
}
origin: org.threeten/threetenbp

/**
 * 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);
}
origin: org.threeten/threetenbp

  void addToBuilder(ZoneRulesBuilder bld) {
    adjustToFowards(2004);  // irrelevant, treat as leap year
    bld.addRuleToWindow(startYear, endYear, month, dayOfMonth, dayOfWeek, time, adjustDays, timeDefinition, savingsAmount);
  }
}
origin: org.threeten/threetenbp

/**
 * Uses a serialization delegate.
 *
 * @return the replacing object, not null
 */
private Object writeReplace() {
  return new Ser(Ser.ZOT, this);
}
origin: org.threeten/threetenbp

/**
 * Uses a serialization delegate.
 *
 * @return the replacing object, not null
 */
private Object writeReplace() {
  return new Ser(Ser.ZOTRULE, this);
}
org.threeten.bp.zone

Most used classes

  • ZoneRules
    The rules defining how the zone offset varies for a single time-zone. The rules model all the histor
  • ZoneRulesProvider
    Provider of time-zone rules to the system. This class manages the configuration of time-zone rules.
  • StandardZoneRules
    The rules describing how the zone offset varies through the year and historically. This class is use
  • ZoneOffsetTransition
    A transition between two offsets caused by a discontinuity in the local time-line. A transition betw
  • ZoneOffsetTransitionRule
    A rule expressing how to create a transition. This class allows rules for identifying future transit
  • TzdbZoneRulesCompiler,
  • TzdbZoneRulesProvider,
  • ZoneRulesCompat,
  • ZoneRulesException,
  • Ser,
  • TzdbZoneRulesCompiler$LeapSecondRule,
  • TzdbZoneRulesCompiler$TZDBRule,
  • TzdbZoneRulesCompiler$TZDBZone,
  • TzdbZoneRulesProvider$Version,
  • ZoneOffsetTransitionRule$TimeDefinition,
  • ZoneRules$Fixed,
  • ZoneRulesBuilder$TZRule,
  • ZoneRulesBuilder$TZWindow,
  • ZoneRulesBuilder
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now