Example #1
0
 public long getUInt() {
   ensureAvailable(4);
   long l =
       ((data[rpos++] << 24) & 0xff000000L)
           | ((data[rpos++] << 16) & 0x00ff0000L)
           | ((data[rpos++] << 8) & 0x0000ff00L)
           | ((data[rpos++]) & 0x000000ffL);
   return l;
 }
Example #2
0
 public String getString() {
   int len = getInt();
   if (len < 0 || len > 32768) {
     throw new IllegalStateException("Bad item length: " + len);
   }
   ensureAvailable(len);
   String s = new String(data, rpos, len);
   rpos += len;
   return s;
 }
Example #3
0
 public long getLong() {
   ensureAvailable(8);
   long l =
       (((long) data[rpos++] << 56) & 0xff00000000000000L)
           | (((long) data[rpos++] << 48) & 0x00ff000000000000L)
           | (((long) data[rpos++] << 40) & 0x0000ff0000000000L)
           | (((long) data[rpos++] << 32) & 0x000000ff00000000L)
           | (((long) data[rpos++] << 24) & 0x00000000ff000000L)
           | (((long) data[rpos++] << 16) & 0x0000000000ff0000L)
           | (((long) data[rpos++] << 8) & 0x000000000000ff00L)
           | (((long) data[rpos++]) & 0x00000000000000ffL);
   return l;
 }
Example #4
0
 public void getRawBytes(byte[] buf, int off, int len) {
   ensureAvailable(len);
   System.arraycopy(data, rpos, buf, off, len);
   rpos += len;
 }
Example #5
0
 public byte getByte() {
   ensureAvailable(1);
   return data[rpos++];
 }