Here you can find the source of readLink(ByteBuffer bb)
Parameter | Description |
---|---|
bb | The byte buffer. |
Parameter | Description |
---|---|
IOException | an exception |
public static long readLink(ByteBuffer bb)
//package com.java2s; //License from project: LGPL import java.nio.ByteBuffer; public class Main { /**// w ww . j a v a 2 s . co m * Read a 64-bit signed integer from the byte buffer, used as byte position within the file. If a LINK is NIL * (corresponds to 0), this means the LINK cannot be de-referenced. A link must be a multiple of 8. * * @param bb The byte buffer. * @return The value. * @throws IOException */ public static long readLink(ByteBuffer bb) { byte[] data = new byte[8]; bb.get(data); long l1 = (((long) data[0] & 0xff) << 0) | (((long) data[1] & 0xff) << 8) | (((long) data[2] & 0xff) << 16) | (((long) data[3] & 0xff) << 24); long l2 = (((long) data[4] & 0xff) << 0) | (((long) data[5] & 0xff) << 8) | (((long) data[6] & 0xff) << 16) | (((long) data[7] & 0xff) << 24); return (l1 << 0) | (l2 << 32); } }