Warning: session_start(): open(/var/lib/php/sessions/sess_5b6fpf2vi3uvmal6htjvvgj285, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass LineCompSemiCached implements AutoCloseable {
File f; // must be the raw text version
RandomAccessFile raf;
int[] literalOffsets;
int[] pairs;
Map files;
S encoding = "UTF-8";
*(File *f) {
if (isGZipFile(f)) fail("Must not be gzipped: " + f2s(f));
LineCompReader reader = new(f);
literalOffsets = reader.literalOffsets;
pairs = intPairsToIntArray(reader.pairs);
files = mapValues toIntArray(reader.versions);
raf = randomAccessFileForReading(f);
}
S getLiteral(int i) {
int start = literalOffsets[i];
ret bytesToString(raf_readFilePart(raf, start, literalOffsets[i+1]-start), encoding);
}
public void close ctex {
if (raf != null) raf.close();
}
int nLiterals() { ret literalOffsets.length-1; }
S getFile(S name) {
int[] encoded = files.get(name);
if (encoded == null) null;
new StringBuilder buf;
for (int idx : encoded)
decode(idx, buf);
ret str(buf);
}
void decode(int idx, StringBuilder buf) {
if (idx < nLiterals()) {
if (empty(buf)) buf.append('\n');
buf.append(getLiteral(idx));
} else {
int idx2 = (idx-nLiterals())*2;
decode(pairs[idx2], buf);
decode(pairs[idx2+1], buf);
}
}
}