public long readLong() throws IOException {
        if (pos + 8 > buf.length ) {
            throw new EOFException();
        }
        long rc = ((long)buf[pos++] << 56) + ((long)(buf[pos++] & 255) << 48) + ((long)(buf[pos++] & 255) << 40) + ((long)(buf[pos++] & 255) << 32);
        return rc + ((long)(buf[pos++] & 255) << 24) + ((buf[pos++] & 255) << 16) + ((buf[pos++] & 255) << 8) + ((buf[pos++] & 255) << 0);
    }
@Test
    public void testReadLong() throws Exception {
        DataByteArrayOutputStream out = new DataByteArrayOutputStream(8);
        out.writeLong(Long.MAX_VALUE);
        out.close();

        DataByteArrayInputStream in = new DataByteArrayInputStream(out.getData());
        long readBack = in.readLong();
        assertEquals(Long.MAX_VALUE, readBack);
    }