fixed typo in class name

pull/607/head
Michael Peter Christen 1 year ago
parent c4082c4ff2
commit ad8ee3a0b6

@ -33,7 +33,7 @@ import java.io.RandomAccessFile;
* moved conditions for exceptions to asserts, * moved conditions for exceptions to asserts,
* refactoring and merge with Utilities * refactoring and merge with Utilities
*/ */
public class RandomAcessFileZIMInputStream extends InputStream { public class RandomAccessFileZIMInputStream extends InputStream {
private final RandomAccessFile mRAFReader; private final RandomAccessFile mRAFReader;
private long mMarked = -1; private long mMarked = -1;
@ -41,7 +41,7 @@ public class RandomAcessFileZIMInputStream extends InputStream {
private final byte[] buffer4 = new byte[4]; private final byte[] buffer4 = new byte[4];
private final byte[] buffer8 = new byte[8]; private final byte[] buffer8 = new byte[8];
public RandomAcessFileZIMInputStream(final RandomAccessFile reader) { public RandomAccessFileZIMInputStream(final RandomAccessFile reader) {
this.mRAFReader = reader; this.mRAFReader = reader;
} }

@ -67,13 +67,13 @@ public class ZIMFile extends File {
} }
// The reader that will be used to read contents from the file // The reader that will be used to read contents from the file
final RandomAcessFileZIMInputStream reader = new RandomAcessFileZIMInputStream(new RandomAccessFile(this, "r")); final RandomAccessFileZIMInputStream reader = new RandomAccessFileZIMInputStream(new RandomAccessFile(this, "r"));
// Read the contents of the header // Read the contents of the header
this.header_magicNumber = reader.readFourLittleEndianBytesInt(); // 4 this.header_magicNumber = reader.readFourLittleEndianBytesInt(); // 4
this.header_majorVersion = reader.readTwoLittleEndianBytesInt(); // 2 this.header_majorVersion = reader.readTwoLittleEndianBytesInt(); // 2
this.header_minorVersion = reader.readTwoLittleEndianBytesInt(); // 4 this.header_minorVersion = reader.readTwoLittleEndianBytesInt(); // 4
RandomAcessFileZIMInputStream.skipFully(reader, 16); // skip the uuid, this is not used RandomAccessFileZIMInputStream.skipFully(reader, 16); // skip the uuid, this is not used
this.header_entryCount = reader.readFourLittleEndianBytesInt(); // 4 this.header_entryCount = reader.readFourLittleEndianBytesInt(); // 4
this.header_clusterCount = reader.readFourLittleEndianBytesInt(); // 4 this.header_clusterCount = reader.readFourLittleEndianBytesInt(); // 4
this.header_urlPtrPos = reader.readEightLittleEndianBytesLong(); // 8 this.header_urlPtrPos = reader.readEightLittleEndianBytesLong(); // 8

@ -41,7 +41,7 @@ import org.tukaani.xz.SingleXZInputStream;
public class ZIMReader { public class ZIMReader {
private final ZIMFile mFile; private final ZIMFile mFile;
private RandomAcessFileZIMInputStream mReader; private RandomAccessFileZIMInputStream mReader;
public static abstract class DirectoryEntry { public static abstract class DirectoryEntry {
@ -100,7 +100,7 @@ public class ZIMReader {
public ZIMReader(final ZIMFile file) { public ZIMReader(final ZIMFile file) {
this.mFile = file; this.mFile = file;
try { try {
this.mReader = new RandomAcessFileZIMInputStream(new RandomAccessFile(this.mFile, "r")); this.mReader = new RandomAccessFileZIMInputStream(new RandomAccessFile(this.mFile, "r"));
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -321,14 +321,14 @@ public class ZIMReader {
offset1 = firstOffset; offset1 = firstOffset;
} else { } else {
location = (article.blob_number - 1) * 4; location = (article.blob_number - 1) * 4;
RandomAcessFileZIMInputStream.skipFully(this.mReader, location); RandomAccessFileZIMInputStream.skipFully(this.mReader, location);
offset1 = this.mReader.readFourLittleEndianBytesInt(); offset1 = this.mReader.readFourLittleEndianBytesInt();
} }
offset2 = this.mReader.readFourLittleEndianBytesInt(); offset2 = this.mReader.readFourLittleEndianBytesInt();
differenceOffset = offset2 - offset1; differenceOffset = offset2 - offset1;
byte[] entry = new byte[differenceOffset]; byte[] entry = new byte[differenceOffset];
RandomAcessFileZIMInputStream.skipFully(this.mReader, (offset1 - 4 * (article.blob_number + 2))); RandomAccessFileZIMInputStream.skipFully(this.mReader, (offset1 - 4 * (article.blob_number + 2)));
this.mReader.read(entry, 0, differenceOffset); this.mReader.read(entry, 0, differenceOffset);
return entry; return entry;
@ -357,16 +357,16 @@ public class ZIMReader {
offset1 = firstOffset; offset1 = firstOffset;
} else { } else {
location = (article.blob_number - 1) * 4; location = (article.blob_number - 1) * 4;
RandomAcessFileZIMInputStream.skipFully(xzReader, location); RandomAccessFileZIMInputStream.skipFully(xzReader, location);
xzReader.read(buffer); xzReader.read(buffer);
offset1 = RandomAcessFileZIMInputStream.toFourLittleEndianInteger(buffer); offset1 = RandomAccessFileZIMInputStream.toFourLittleEndianInteger(buffer);
} }
xzReader.read(buffer); xzReader.read(buffer);
offset2 = RandomAcessFileZIMInputStream.toFourLittleEndianInteger(buffer); offset2 = RandomAccessFileZIMInputStream.toFourLittleEndianInteger(buffer);
differenceOffset = offset2 - offset1; differenceOffset = offset2 - offset1;
byte[] entry = new byte[differenceOffset]; byte[] entry = new byte[differenceOffset];
RandomAcessFileZIMInputStream.skipFully(xzReader, (offset1 - 4 * (article.blob_number + 2))); RandomAccessFileZIMInputStream.skipFully(xzReader, (offset1 - 4 * (article.blob_number + 2)));
xzReader.read(entry, 0, differenceOffset); xzReader.read(entry, 0, differenceOffset);
return entry; return entry;

Loading…
Cancel
Save