\r
\r
// WRITE
-
+\r
+ void _putLong(long value) throws IOException\r
+ {\r
+ prepareForWrite(8);\r
+ int posInBuf = (int) (pointer - buf_pos);\r
+ buf[posInBuf] = (byte) (value >>> 56);\r
+ buf[posInBuf+1] = (byte) (value >>> 48);\r
+ buf[posInBuf+2] = (byte) (value >>> 40);\r
+ buf[posInBuf+3] = (byte) (value >>> 32);\r
+ buf[posInBuf+4] = (byte) (value >>> 24);\r
+ buf[posInBuf+5] = (byte) (value >>> 16);\r
+ buf[posInBuf+6] = (byte) (value >>> 8);\r
+ buf[posInBuf+7] = (byte) value;\r
+ posInBuf += 8;\r
+ pointer += 8;\r
+ if (write_buf_count<posInBuf) write_buf_count = posInBuf;\r
+ if (readable_bytes_count<write_buf_count) readable_bytes_count=write_buf_count;\r
+ if (virtualLength<pointer) virtualLength=pointer;\r
+ }\r
+\r
+ void _putInt(int value) throws IOException\r
+ {\r
+ prepareForWrite(4);\r
+ int posInBuf = (int) (pointer - buf_pos);\r
+ buf[posInBuf] = (byte) (value >>> 24);\r
+ buf[posInBuf+1] = (byte) (value >>> 16);\r
+ buf[posInBuf+2] = (byte) (value >>> 8);\r
+ buf[posInBuf+3] = (byte) value;\r
+ posInBuf += 4;\r
+ pointer += 4;\r
+ if (write_buf_count<posInBuf) write_buf_count = posInBuf;\r
+ if (readable_bytes_count<write_buf_count) readable_bytes_count=write_buf_count;\r
+ if (virtualLength<pointer) virtualLength=pointer;\r
+ }\r
+
void _put(int value) throws IOException
{
prepareForWrite(1);
@Override
public void writeInt(int value) throws IOException {
- _put(value >>> 24);
- _put(value >>> 16);
- _put(value >>> 8);
- _put(value);
+ _putInt(value);
}
@Override
public void writeLong(long value) throws IOException {
- _put((int) (value >>> 56));
- _put((int) (value >>> 48));
- _put((int) (value >>> 40));
- _put((int) (value >>> 32));
- _put((int) (value >>> 24));
- _put((int) (value >>> 16));
- _put((int) (value >>> 8));
- _put((int) (value));
+ _putLong(value);
}
@Override