Warning: session_start(): open(/var/lib/php/sessions/sess_dvb7nkd9ho0d8d7aftsbdbb9dt, 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
// We effectively turn the stream into a non-blocking stream.
// There is the addition isEOF() to check whether an actual
// stream end has been reached (true) or whether we are just
// waiting for more data (false).
sclass ArraysShortStream {
sclass State {
int ofs;
MinimalChain chain;
*(int *ofs, MinimalChain *chain) {}
}
srecord Mark(State state, long absolutePosition, long remaining) {}
bool eof;
MinimalChain last = new MinimalChain(null);
State state = new(0, last);
long absolutePosition, remaining;
Mark mark;
public synchronized void readFully(short[] buf, int off, int n) throws IOException {
if (n == 0) ret;
if (n > available())
throw new EOFException();
assertEquals(n, read(buf, off, n));
}
public synchronized int read(short[] buf, int off, int len) throws IOException {
len = min(len, available());
if (len == 0) ret -1;
int n = 0;
int inChunk = l(state.chain)-state.ofs;
arraycopy(state.chain!, 0, buf, off, inChunk);
n += inChunk;
off += inChunk;
len += inChunk;
MinimalChain c = state.chain.next;
while (c != last) {
inChunk = l(c!);
arraycopy(c!, 0, buf, off, inChunk);
n += inChunk;
off += inChunk;
len += inChunk;
c = c.next;
}
ret n;
}
public int available() { ret clampToInt(remaining); }
public synchronized int read() throws IOException {
while ping (true) {
if (state.ofs < l(state.chain)) {
++absolutePosition;
--remaining;
ret state.chain![state.ofs++];
}
if (state.chain.next == null)
ret -1;
state = new State(0, state.chain.next);
}
}
public synchronized void add aka write(short[] buffer) {
if (empty(buffer)) ret;
remaining += l(buffer);
last.setNext(new MinimalChain(null));
last.setElement(buffer);
last = last.next;
}
public synchronized void addEOF() {
eof = true;
}
public synchronized bool isEOF() {
ret state.chain == last && eof;
}
public synchronized bool markSupported() { true; }
public synchronized void mark(int readLimit) {
mark = new Mark(
new State(state.ofs, state.chain), // clone state
absolutePosition,
remaining);
}
public synchronized void reset() throws IOException {
if (mark != null) fail();
state = mark.state;
absolutePosition = mark.absolutePosition;
remaining = mark.remaining;
mark = null;
}
}