gpt4 book ai didi

libcore.util.ZoneInfo类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 03:09:31 30 4
gpt4 key购买 nike

本文整理了Java中libcore.util.ZoneInfo类的一些代码示例,展示了ZoneInfo类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneInfo类的具体详情如下:
包路径:libcore.util.ZoneInfo
类名称:ZoneInfo

ZoneInfo介绍

[英]Our concrete TimeZone implementation, backed by zoneinfo data.
[中]我们的具体时区实施,由zoneinfo数据支持。

代码示例

代码示例来源:origin: robovm/robovm

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;
}

代码示例来源:origin: robovm/robovm

@Override public boolean equals(Object obj) {
  if (!(obj instanceof ZoneInfo)) {
    return false;
  }
  ZoneInfo other = (ZoneInfo) obj;
  return getID().equals(other.getID()) && hasSameRules(other);
}

代码示例来源:origin: robovm/robovm

@Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
  // XXX This assumes Gregorian always; Calendar switches from
  // Julian to Gregorian in 1582.  What calendar system are the
  // arguments supposed to come from?
  long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
  year %= 400;
  calc += year * (365 * MILLISECONDS_PER_DAY);
  calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
  if (year > 0) {
    calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
  }
  boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
  int[] mlen = isLeap ? LEAP : NORMAL;
  calc += mlen[month] * MILLISECONDS_PER_DAY;
  calc += (day - 1) * MILLISECONDS_PER_DAY;
  calc += millis;
  calc -= mRawOffset;
  calc -= UNIX_OFFSET;
  return getOffset(calc);
}

代码示例来源:origin: robovm/robovm

@Override
  public String toString() {
    return getClass().getName() + "[id=\"" + getID() + "\"" +
      ",mRawOffset=" + mRawOffset +
      ",mEarliestRawOffset=" + mEarliestRawOffset +
      ",mUseDst=" + mUseDst +
      ",mDstSavings=" + mDstSavings +
      ",transitions=" + mTransitions.length +
      "]";
  }
}

代码示例来源:origin: robovm/robovm

public TimeZone makeTimeZone(String id) throws IOException {
  // Work out where in the big data file this time zone is.
  int index = Arrays.binarySearch(ids, id);
  if (index < 0) {
   return null;
  }
  BufferIterator it = mappedFile.bigEndianIterator();
  it.skip(byteOffsets[index]);
  return ZoneInfo.makeTimeZone(id, it);
 }
}

代码示例来源:origin: robovm/robovm

return new ZoneInfo(id, transitions, type, gmtOffsets, isDsts);

代码示例来源:origin: robovm/robovm

mTypes = types;
mIsDsts = isDsts;
setID(name);

代码示例来源:origin: robovm/robovm

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + getID().hashCode();
  result = prime * result + Arrays.hashCode(mOffsets);
  result = prime * result + Arrays.hashCode(mIsDsts);
  result = prime * result + mRawOffset;
  result = prime * result + Arrays.hashCode(mTransitions);
  result = prime * result + Arrays.hashCode(mTypes);
  result = prime * result + (mUseDst ? 1231 : 1237);
  return result;
}

代码示例来源:origin: ibinti/bugvm

public TimeZone makeTimeZone(String id) throws IOException {
  // Work out where in the big data file this time zone is.
  int index = Arrays.binarySearch(ids, id);
  if (index < 0) {
   return null;
  }
  BufferIterator it = mappedFile.bigEndianIterator();
  it.skip(byteOffsets[index]);
  return ZoneInfo.makeTimeZone(id, it);
 }
}

代码示例来源:origin: ibinti/bugvm

return new ZoneInfo(id, transitions, type, gmtOffsets, isDsts);

代码示例来源:origin: MobiVM/robovm

mTypes = types;
mIsDsts = isDsts;
setID(name);

代码示例来源:origin: ibinti/bugvm

@Override public boolean equals(Object obj) {
  if (!(obj instanceof ZoneInfo)) {
    return false;
  }
  ZoneInfo other = (ZoneInfo) obj;
  return getID().equals(other.getID()) && hasSameRules(other);
}

代码示例来源:origin: ibinti/bugvm

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;
}

代码示例来源:origin: ibinti/bugvm

@Override
  public String toString() {
    return getClass().getName() + "[id=\"" + getID() + "\"" +
      ",mRawOffset=" + mRawOffset +
      ",mEarliestRawOffset=" + mEarliestRawOffset +
      ",mUseDst=" + mUseDst +
      ",mDstSavings=" + mDstSavings +
      ",transitions=" + mTransitions.length +
      "]";
  }
}

代码示例来源:origin: MobiVM/robovm

public TimeZone makeTimeZone(String id) throws IOException {
  // Work out where in the big data file this time zone is.
  int index = Arrays.binarySearch(ids, id);
  if (index < 0) {
   return null;
  }
  BufferIterator it = mappedFile.bigEndianIterator();
  it.skip(byteOffsets[index]);
  return ZoneInfo.makeTimeZone(id, it);
 }
}

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
  // XXX This assumes Gregorian always; Calendar switches from
  // Julian to Gregorian in 1582.  What calendar system are the
  // arguments supposed to come from?
  long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
  year %= 400;
  calc += year * (365 * MILLISECONDS_PER_DAY);
  calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
  if (year > 0) {
    calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
  }
  boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
  int[] mlen = isLeap ? LEAP : NORMAL;
  calc += mlen[month] * MILLISECONDS_PER_DAY;
  calc += (day - 1) * MILLISECONDS_PER_DAY;
  calc += millis;
  calc -= mRawOffset;
  calc -= UNIX_OFFSET;
  return getOffset(calc);
}

代码示例来源:origin: com.bugvm/bugvm-rt

return new ZoneInfo(id, transitions, type, gmtOffsets, isDsts);

代码示例来源:origin: ibinti/bugvm

mTypes = types;
mIsDsts = isDsts;
setID(name);

代码示例来源:origin: com.bugvm/bugvm-rt

@Override public boolean equals(Object obj) {
  if (!(obj instanceof ZoneInfo)) {
    return false;
  }
  ZoneInfo other = (ZoneInfo) obj;
  return getID().equals(other.getID()) && hasSameRules(other);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

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;
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com