/** * Get the length of this table */ public int getLength() { if (isLongFormat()) { return offsets.length * 4; } else { return offsets.length * 2; } } }
/** * Get the length of this table */ public int getLength() { if (isLongFormat()) { return offsets.length * 4; } else { return offsets.length * 2; } } }
/** * Get the length of this table */ public int getLength() { if (isLongFormat()) { return offsets.length * 4; } else { return offsets.length * 2; } } }
/** Initialize this structure from a ByteBuffer */ public void setData(ByteBuffer data) { for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { offsets[i] = data.getInt(); } else { offsets[i] = 2 * ( 0xFFFF & (int) data.getShort()); } } }
/** Initialize this structure from a ByteBuffer */ public void setData(ByteBuffer data) { for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { offsets[i] = data.getInt(); } else { offsets[i] = 2 * ( 0xFFFF & (int) data.getShort()); } } }
/** Initialize this structure from a ByteBuffer */ public void setData(ByteBuffer data) { for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { offsets[i] = data.getInt(); } else { offsets[i] = 2 * ( 0xFFFF & (int) data.getShort()); } } }
/** get the data in this map as a ByteBuffer */ public ByteBuffer getData() { int size = getLength(); ByteBuffer buf = ByteBuffer.allocate(size); // write the offsets for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { buf.putInt(offsets[i]); } else { buf.putShort((short) (offsets[i] / 2)); } } // reset the start pointer buf.flip(); return buf; }
/** get the data in this map as a ByteBuffer */ public ByteBuffer getData() { int size = getLength(); ByteBuffer buf = ByteBuffer.allocate(size); // write the offsets for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { buf.putInt(offsets[i]); } else { buf.putShort((short) (offsets[i] / 2)); } } // reset the start pointer buf.flip(); return buf; }
/** get the data in this map as a ByteBuffer */ public ByteBuffer getData() { int size = getLength(); ByteBuffer buf = ByteBuffer.allocate(size); // write the offsets for (int i = 0; i < offsets.length; i++) { if (isLongFormat()) { buf.putInt(offsets[i]); } else { buf.putShort((short) (offsets[i] / 2)); } } // reset the start pointer buf.flip(); return buf; }