Warning: session_start(): open(/var/lib/php/sessions/sess_gdsaapla7uatdj480eo4nsamec, 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
!include once #1027304 // Eclipse Collections
import java.nio.*;
import java.nio.channels.*;
// read-only, so far. should be thread-safe
final sclass RAMByteMemory64 implements IByteMemory64, AutoCloseable {
long size; // file size in ints
bool bigEndian = true;
bool debug;
// byte buffers
int arrayShift = 30; // each buffer is 1 GB
int arraySize = 1 << arrayShift;
byte[] arrays;
*(File file) {
load(file);
}
void load(File file) ctex {
size = fileSize(file);
temp RandomAccessFile raf = newRandomAccessFile(file, "r");
arrays = new byte[toInt(rightShift_ceil(size, arrayShift))][];
FileChannel channel = raf.getChannel();
print("Allocating " + size + " bytes");
for i over arrays: {
long pos = (long) i << arrayShift;
int len = toInt(min(1 << arrayShift, size-pos));
arrays[i] = new byte[len];
}
for i over arrays: {
long pos = (long) i << arrayShift;
int len = l(arrays[i]);
print("Loading bytes " + longToHex(pos) + "-" + longToHex(pos+len) + " of " + file);
MappedByteBuffer byteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, pos, len);
byteBuffer.get(arrays[i]);
}
print(size + " bytes loaded");
}
public void close {}
public byte getByte(long idx) {
rangeCheck(idx, size);
ret buffers[(int) (idx >> arrayShift)].get(((int) idx) & (arraySize-1));
}
public int getInt(long idx) {
assertTrue(+bigEndian);
ret ubyteToInt(getByte(idx)) << 24 |
ubyteToInt(getByte(idx+1)) << 16 |
ubyteToInt(getByte(idx+2)) << 8 |
ubyteToInt(getByte(idx+3));
}
public void set(long idx, int val) {
checkWritable();
fail("todo");
}
void checkWritable {
if (!writable) fail("read-only");
}
public long size() {
ret size;
}
public void ensureSize(int size) {
this.size = max(this.size, size);
}
}