if (it.readInt() != 0x545a6966) { // "TZif" return null; it.skip(28); int tzh_timecnt = it.readInt(); int tzh_typecnt = it.readInt(); it.skip(4); // Skip tzh_charcnt. it.readIntArray(transitions, 0, transitions.length); it.readByteArray(type, 0, type.length); gmtOffsets[i] = it.readInt(); isDsts[i] = it.readByte(); it.skip(1);
ByteOrder.LITTLE_ENDIAN); int sig = it.readInt(); if (sig != CENSIG) { ZipFile.throwZipException("Central Directory Entry", sig); it.seek(8); int gpbf = it.readShort() & 0xffff; compressionMethod = it.readShort() & 0xffff; time = it.readShort() & 0xffff; modDate = it.readShort() & 0xffff; crc = ((long) it.readInt()) & 0xffffffffL; compressedSize = ((long) it.readInt()) & 0xffffffffL; size = ((long) it.readInt()) & 0xffffffffL; nameLength = it.readShort() & 0xffff; int extraLength = it.readShort() & 0xffff; int commentByteCount = it.readShort() & 0xffff; it.seek(42); localHeaderRelOffset = ((long) it.readInt()) & 0xffffffffL;
private void readZoneTab(BufferIterator it, int zoneTabOffset, int zoneTabSize) { byte[] bytes = new byte[zoneTabSize]; it.seek(zoneTabOffset); it.readByteArray(bytes, 0, bytes.length); zoneTab = new String(bytes, 0, bytes.length, StandardCharsets.US_ASCII); }
private void readIndex(BufferIterator it, int indexOffset, int dataOffset) { it.seek(indexOffset); it.readByteArray(idBytes, 0, idBytes.length); byteOffsets[i] = it.readInt(); int length = it.readInt(); if (length < 44) { throw new AssertionError("length in index file < sizeof(tzhead)"); rawUtcOffsets[i] = it.readInt();
int diskNumber = it.readShort() & 0xffff; int diskWithCentralDir = it.readShort() & 0xffff; int numEntries = it.readShort() & 0xffff; int totalNumEntries = it.readShort() & 0xffff; it.skip(4); // Ignore centralDirSize. long centralDirOffset = ((long) it.readInt()) & 0xffffffffL; int commentLength = it.readShort() & 0xffff;
private void readHeader() { // byte[12] tzdata_version -- "tzdata2012f\0" // int index_offset // int data_offset // int zonetab_offset BufferIterator it = mappedFile.bigEndianIterator(); byte[] tzdata_version = new byte[12]; it.readByteArray(tzdata_version, 0, tzdata_version.length); String magic = new String(tzdata_version, 0, 6, StandardCharsets.US_ASCII); if (!magic.equals("tzdata") || tzdata_version[11] != 0) { throw new RuntimeException("bad tzdata magic: " + Arrays.toString(tzdata_version)); } version = new String(tzdata_version, 6, 5, StandardCharsets.US_ASCII); int index_offset = it.readInt(); int data_offset = it.readInt(); int zonetab_offset = it.readInt(); readIndex(it, index_offset, data_offset); readZoneTab(it, zonetab_offset, (int) mappedFile.size() - zonetab_offset); }
int diskNumber = it.readShort() & 0xffff; int diskWithCentralDir = it.readShort() & 0xffff; int numEntries = it.readShort() & 0xffff; int totalNumEntries = it.readShort() & 0xffff; long centralDirSize = ((long) it.readInt()) & 0xffffffffL; long centralDirOffset = ((long) it.readInt()) & 0xffffffffL; int commentLength = it.readShort() & 0xffff;
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); } }
private void readIndex(BufferIterator it, int indexOffset, int dataOffset) { it.seek(indexOffset); it.readByteArray(idBytes, 0, idBytes.length); byteOffsets[i] = it.readInt(); int length = it.readInt(); if (length < 44) { throw new AssertionError("length in index file < sizeof(tzhead)"); rawUtcOffsets[i] = it.readInt();
int diskNumber = it.readShort() & 0xffff; int diskWithCentralDir = it.readShort() & 0xffff; int numEntries = it.readShort() & 0xffff; int totalNumEntries = it.readShort() & 0xffff; it.skip(4); // Ignore centralDirSize. long centralDirOffset = ((long) it.readInt()) & 0xffffffffL; int commentLength = it.readShort() & 0xffff;
private void readZoneTab(BufferIterator it, int zoneTabOffset, int zoneTabSize) { byte[] bytes = new byte[zoneTabSize]; it.seek(zoneTabOffset); it.readByteArray(bytes, 0, bytes.length); zoneTab = new String(bytes, 0, bytes.length, StandardCharsets.US_ASCII); }
private void readHeader() { // byte[12] tzdata_version -- "tzdata2012f\0" // int index_offset // int data_offset // int zonetab_offset BufferIterator it = mappedFile.bigEndianIterator(); byte[] tzdata_version = new byte[12]; it.readByteArray(tzdata_version, 0, tzdata_version.length); String magic = new String(tzdata_version, 0, 6, StandardCharsets.US_ASCII); if (!magic.equals("tzdata") || tzdata_version[11] != 0) { throw new RuntimeException("bad tzdata magic: " + Arrays.toString(tzdata_version)); } version = new String(tzdata_version, 6, 5, StandardCharsets.US_ASCII); int index_offset = it.readInt(); int data_offset = it.readInt(); int zonetab_offset = it.readInt(); readIndex(it, index_offset, data_offset); readZoneTab(it, zonetab_offset, (int) mappedFile.size() - zonetab_offset); }
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); } }
if (it.readInt() != 0x545a6966) { // "TZif" return null; it.skip(28); int tzh_timecnt = it.readInt(); int tzh_typecnt = it.readInt(); it.skip(4); // Skip tzh_charcnt. it.readIntArray(transitions, 0, transitions.length); it.readByteArray(type, 0, type.length); gmtOffsets[i] = it.readInt(); isDsts[i] = it.readByte(); it.skip(1);
ByteOrder.LITTLE_ENDIAN); int sig = it.readInt(); if (sig != CENSIG) { ZipFile.throwZipException("Central Directory Entry", sig); it.seek(8); int gpbf = it.readShort() & 0xffff; compressionMethod = it.readShort() & 0xffff; time = it.readShort() & 0xffff; modDate = it.readShort() & 0xffff; crc = ((long) it.readInt()) & 0xffffffffL; compressedSize = ((long) it.readInt()) & 0xffffffffL; size = ((long) it.readInt()) & 0xffffffffL; nameLength = it.readShort() & 0xffff; int extraLength = it.readShort() & 0xffff; int commentByteCount = it.readShort() & 0xffff; it.seek(42); localHeaderRelOffset = ((long) it.readInt()) & 0xffffffffL;
private void readIndex(BufferIterator it, int indexOffset, int dataOffset) { it.seek(indexOffset); it.readByteArray(idBytes, 0, idBytes.length); byteOffsets[i] = it.readInt(); int length = it.readInt(); if (length < 44) { throw new AssertionError("length in index file < sizeof(tzhead)"); rawUtcOffsets[i] = it.readInt();
int diskNumber = it.readShort() & 0xffff; int diskWithCentralDir = it.readShort() & 0xffff; int numEntries = it.readShort() & 0xffff; int totalNumEntries = it.readShort() & 0xffff; it.skip(4); // Ignore centralDirSize. long centralDirOffset = ((long) it.readInt()) & 0xffffffffL; int commentLength = it.readShort() & 0xffff;
private void readZoneTab(BufferIterator it, int zoneTabOffset, int zoneTabSize) { byte[] bytes = new byte[zoneTabSize]; it.seek(zoneTabOffset); it.readByteArray(bytes, 0, bytes.length); zoneTab = new String(bytes, 0, bytes.length, StandardCharsets.US_ASCII); }
private void readHeader() { // byte[12] tzdata_version -- "tzdata2012f\0" // int index_offset // int data_offset // int zonetab_offset BufferIterator it = mappedFile.bigEndianIterator(); byte[] tzdata_version = new byte[12]; it.readByteArray(tzdata_version, 0, tzdata_version.length); String magic = new String(tzdata_version, 0, 6, StandardCharsets.US_ASCII); if (!magic.equals("tzdata") || tzdata_version[11] != 0) { throw new RuntimeException("bad tzdata magic: " + Arrays.toString(tzdata_version)); } version = new String(tzdata_version, 6, 5, StandardCharsets.US_ASCII); int index_offset = it.readInt(); int data_offset = it.readInt(); int zonetab_offset = it.readInt(); readIndex(it, index_offset, data_offset); readZoneTab(it, zonetab_offset, (int) mappedFile.size() - zonetab_offset); }
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); } }