- volatile SoftReference<String> htmlRef = new SoftReference<String>(null);
-
- private LazyHtmlLoader(final RandomAccessFile raf) throws IOException {
- this.raf = raf;
- numBytes = raf.readInt();
- numZipBytes = raf.readInt();
- offset = raf.getFilePointer();
+ volatile SoftReference<String> htmlRef = new SoftReference<>(null);
+
+ private LazyHtmlLoader(FileChannel ch, final DataInput inp, List<byte[]> data, int index) throws IOException {
+ this.data = data;
+ this.index = index;
+ if (data != null) {
+ this.raf = null;
+ this.ch = null;
+ this.offset = 0;
+ this.numBytes = -1;
+ this.numZipBytes = -1;
+ return;
+ }
+ raf = inp;
+ this.ch = ch;
+ numBytes = Math.min(raf.readInt(), 20 * 1024 * 1024);
+ numZipBytes = Math.min(raf.readInt(), 20 * 1024 * 1024);
+ offset = ch.position();