Beispiel #1
0
  public TZRule(RawInputStream ris) throws IOException {
    int MajorVersion = ris.readU8(); // 0x02
    int MinorVersion = ris.readU8(); // 0x01
    int ReservedInt = ris.readU16(); // 0x003E

    // TZRuleFlags Little Endian 000000ER000000000
    //     R (TZRULE_FLAG_RECUR_CURRENT_TZREG, 0x0001): rule is associated with a recurring series.
    //     E (TZRULE_FLAG_EFFECTIVE_TZREG, 0x0002): This is the effective rule.
    // If this rule represents the time zone rule that will be used to convert to and from UTC, both
    // of these
    // flags are set (for example, the value is 0x0003). If this is not the active time zone rule,
    // neither of
    // these flags are set. These flags are set on exactly one TZRule that is contained in this
    // property, and
    // the flags for all other rules MUST be set to 0.
    int TZRuleFlags = ris.readU16();
    isAssociatedWithRecurrence = ((TZRuleFlags & 0x0001) == 0x0001);
    isEffectiveRule = ((TZRuleFlags & 0x0002) == 0x0002);
    setStartYear(ris.readU16());
    ris.skip(14);
    setBias(readI32(ris));
    setStandardBias(readI32(ris));
    setDaylightBias(readI32(ris));
    setStandardDate(new SYSTEMTIME(ris));
    setDaylightDate(new SYSTEMTIME(ris));

    if (sLog.isDebugEnabled()) {
      StringBuffer debugInfo = new StringBuffer();
      debugInfo.append("TZRule: effective=");
      debugInfo.append(isEffectiveRule);
      debugInfo.append(" AssociatedWithRecurrence=");
      debugInfo.append(isAssociatedWithRecurrence);
      debugInfo.append("\n");
      if (MajorVersion != 0x2) {
        debugInfo.append("    Unexpected MajorVersion=");
        debugInfo.append(MajorVersion);
        debugInfo.append("\n");
      }
      if (MinorVersion != 0x1) {
        debugInfo.append("    Unexpected MinorVersion=");
        debugInfo.append(MinorVersion);
        debugInfo.append("\n");
      }
      if (ReservedInt != 0x3E) {
        debugInfo.append("    Unexpected Reserved=0x");
        debugInfo.append(Integer.toHexString(ReservedInt));
        debugInfo.append("\n");
      }
      debugInfo.append("    Start Year=");
      debugInfo.append(getStartYear());
      debugInfo.append(" Bias=");
      debugInfo.append(Bias);
      debugInfo.append(" StandardBias=");
      debugInfo.append(getStandardBias());
      debugInfo.append(" DaylightBias=");
      debugInfo.append(getDaylightBias());
      debugInfo.append("\n");
      debugInfo.append("    standard info:");
      if (getStandardDate() != null) {
        debugInfo.append(getStandardDate());
        debugInfo.append("\n");
      }
      if (getDaylightDate() != null) {
        debugInfo.append("    daylight info:");
        debugInfo.append(getDaylightDate());
      }
      sLog.debug(debugInfo);
    }
  }
Beispiel #2
0
 /**
  * Missing method from RawInputStream
  *
  * @param ris
  * @return
  * @throws IOException
  */
 private Long readI32(RawInputStream ris) throws IOException {
   return (ris.readU8() | (ris.readU8() << 8) | (ris.readU8() << 16) | (ris.readU8() << 24))
       & 0xFFFFFFFFFFFFFFFFL;
 }