/** * 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 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 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; }