@Override public void writeBoolean(boolean b) throws IOException { if (buf.length < (pos + 1)) ensure(1); buf[pos++] = (byte)(b ? 1 : 0); assert check(); }
@Override public void writeBoolean(boolean b) throws IOException { if (buf.length < (pos + 1)) ensure(1); buf[pos++] = (byte)(b ? 1 : 0); assert check(); }
private void doWriteBytes(byte[] bytes, int start, int len) throws IOException { if (len < buf.length) { ensure(len); System.arraycopy(bytes, start, buf, pos, len); pos += len; } else { ensure(buf.length); assert blockStack[stackTop].state == BlockedValue.State.ROOT || blockStack[stackTop].state == BlockedValue.State.OVERFLOW; write(bytes, start, len); } assert check(); }
private void doWriteBytes(byte[] bytes, int start, int len) throws IOException { if (len < buf.length) { ensure(len); System.arraycopy(bytes, start, buf, pos, len); pos += len; } else { ensure(buf.length); assert blockStack[stackTop].state == BlockedValue.State.ROOT || blockStack[stackTop].state == BlockedValue.State.OVERFLOW; write(bytes, start, len); } assert check(); }
@Override public void writeLong(long n) throws IOException { if (pos + 10 > buf.length) { ensure(10); } pos = encodeLong(n, buf, pos); assert check(); }
@Override public void writeDouble(double d) throws IOException { if (pos + 8 > buf.length) { ensure(8); } pos = encodeDouble(d, buf, pos); assert check(); }
@Override public void writeIndex(int unionIndex) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(unionIndex, buf, pos); assert check(); }
@Override public void writeInt(int n) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(n, buf, pos); assert check(); }
@Override public void writeDouble(double d) throws IOException { if (pos + 8 > buf.length) { ensure(8); } pos = encodeDouble(d, buf, pos); assert check(); }
@Override public void writeInt(int n) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(n, buf, pos); assert check(); }
@Override public void writeFloat(float f) throws IOException { if (pos + 4 > buf.length) { ensure(4); } pos = encodeFloat(f, buf, pos); assert check(); }
@Override public void writeFloat(float f) throws IOException { if (pos + 4 > buf.length) { ensure(4); } pos = encodeFloat(f, buf, pos); assert check(); }
@Override public void writeIndex(int unionIndex) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(unionIndex, buf, pos); assert check(); }
@Override public void writeLong(long n) throws IOException { if (pos + 10 > buf.length) { ensure(10); } pos = encodeLong(n, buf, pos); assert check(); }
@Override public void writeBytes(byte[] bytes, int start, int len) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(len, buf, pos); doWriteBytes(bytes, start, len); assert check(); }
@Override public void writeBytes(byte[] bytes, int start, int len) throws IOException { if (pos + 5 > buf.length) { ensure(5); } pos = encodeLong(len, buf, pos); doWriteBytes(bytes, start, len); assert check(); }
if (buf.length < (pos + 1)) ensure(1); buf[pos++] = 0; // Sentinel for last block in a blocked value assert check();
if (buf.length < (pos + 1)) ensure(1); buf[pos++] = 0; // Sentinel for last block in a blocked value assert check();