public static long readLongCompressed(byte[] buf, int offset) { byte len=buf[offset++]; if(len == 0) return 0; byte[] buffer=new byte[len]; for(int i=0; i < len; i++) buffer[i]=buf[offset++]; return makeLong(buffer, 0, len); }
public static long readLongCompressed(byte[] buf, int offset) { byte len=buf[offset++]; if(len == 0) return 0; byte[] buffer=new byte[len]; for(int i=0; i < len; i++) buffer[i]=buf[offset++]; return makeLong(buffer, 0, len); }
public static long readLongCompressed(byte[] buf, int offset) { byte len=buf[offset++]; if(len == 0) return 0; byte[] buffer=new byte[len]; for(int i=0; i < len; i++) buffer[i]=buf[offset++]; return makeLong(buffer, 0, len); }
/** * Reads a long from a buffer. * @param buf the buffer * @return the long read from the buffer */ public static long readLong(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; byte[] retval=new byte[len]; buf.get(retval, 0, len); return makeLong(retval, 0, len); }
/** * Reads a long from a buffer. * @param buf the buffer * @return the long read from the buffer */ public static long readLong(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; byte[] retval=new byte[len]; buf.get(retval, 0, len); return makeLong(retval, 0, len); }
/** * Reads a long from a buffer. * @param buf the buffer * @return the long read from the buffer */ public static long readLong(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; byte[] retval=new byte[len]; buf.get(retval, 0, len); return makeLong(retval, 0, len); }
/** * Reads a variable-length encoded long from an input stream. Note that currently variable-length encoding is <em>not</em> * used (a similar mechanism is used); this will be implemented later. * @param in the input stream * @return the long read from the input stream * @throws IOException */ public static long readLong(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; byte[] buf=new byte[len]; in.readFully(buf, 0, len); return makeLong(buf, 0, len); }
/** * Reads a variable-length encoded long from an input stream. Note that currently variable-length encoding is <em>not</em> * used (a similar mechanism is used); this will be implemented later. * @param in the input stream * @return the long read from the input stream * @throws IOException */ public static long readLong(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; byte[] buf=new byte[len]; in.readFully(buf, 0, len); return makeLong(buf, 0, len); }
/** * Reads a variable-length encoded long from an input stream. Note that currently variable-length encoding is <em>not</em> * used (a similar mechanism is used); this will be implemented later. * @param in the input stream * @return the long read from the input stream * @throws IOException */ public static long readLong(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; byte[] buf=new byte[len]; in.readFully(buf, 0, len); return makeLong(buf, 0, len); }
/** * Reads 2 compressed longs from in. * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param in the input stream to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] buf=new byte[lengths[0] + lengths[1]]; in.readFully(buf, 0, buf.length); seqnos[0]=makeLong(buf, 0, lengths[0]); seqnos[1]=makeLong(buf, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }
/** * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param buf the buffer to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] retval=new byte[lengths[0] + lengths[1]]; buf.get(retval, 0, retval.length); seqnos[0]=makeLong(retval, 0, lengths[0]); seqnos[1]=makeLong(retval, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }
/** * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param buf the buffer to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] retval=new byte[lengths[0] + lengths[1]]; buf.get(retval, 0, retval.length); seqnos[0]=makeLong(retval, 0, lengths[0]); seqnos[1]=makeLong(retval, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }
/** * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param buf the buffer to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] retval=new byte[lengths[0] + lengths[1]]; buf.get(retval, 0, retval.length); seqnos[0]=makeLong(retval, 0, lengths[0]); seqnos[1]=makeLong(retval, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }
/** * Reads 2 compressed longs from in. * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param in the input stream to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] buf=new byte[lengths[0] + lengths[1]]; in.readFully(buf, 0, buf.length); seqnos[0]=makeLong(buf, 0, lengths[0]); seqnos[1]=makeLong(buf, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }
/** * Reads 2 compressed longs from in. * Reads 2 compressed longs from buf. * <p/> * Once variable-length encoding has been implemented, this method will probably get dropped as we can simply * read the 2 longs individually. * @param in the input stream to read from * @return an array of 2 longs (hd and hr) */ public static long[] readLongSequence(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return new long[]{0,0}; byte[] lengths=decodeLength(len); long[] seqnos=new long[2]; byte[] buf=new byte[lengths[0] + lengths[1]]; in.readFully(buf, 0, buf.length); seqnos[0]=makeLong(buf, 0, lengths[0]); seqnos[1]=makeLong(buf, lengths[0], lengths[1]) + seqnos[0]; return seqnos; }