| | |
| | | public static final int PRIMARY_CLASS = 0; |
| | | public static final int PRIMARY_RULE_CLASS = 0; |
| | | |
| | | protected short[] raw; |
| | | protected byte attrOffset = 0; |
| | | protected short[] raw; |
| | | protected byte attrOffset = 0; |
| | | protected ByteBuffer rawBuffer; |
| | | |
| | | public Element(short[] raw) |
| | | public Element(byte[] raw) |
| | | { |
| | | this.raw = raw; |
| | | // this.raw = raw; |
| | | this.raw = new short[raw.length / 2]; |
| | | rawBuffer = ByteBuffer.wrap(raw); |
| | | rawBuffer.order(ByteOrder.LITTLE_ENDIAN); |
| | | rawBuffer.asShortBuffer().get(this.raw); |
| | | } |
| | | |
| | | public int getLineStyle() |
| | |
| | | } |
| | | } |
| | | |
| | | protected static int getOffsetPosition(int offset) |
| | | { |
| | | return offset * 2; |
| | | } |
| | | |
| | | public static class ElementHandler implements IElementHandler |
| | | { |
| | |
| | | |
| | | public Object read(ByteBuffer buffer, short signature, int length) |
| | | { |
| | | byte[] dst = new byte[length - 4]; |
| | | byte[] dst = new byte[length]; |
| | | try |
| | | { |
| | | buffer.get(dst, 0, dst.length); |
| | | buffer.get(dst, 4, dst.length - 4); |
| | | } catch (BufferUnderflowException exception) |
| | | { |
| | | throw exception; |
| | | } |
| | | |
| | | ByteBuffer tmpBuffer = ByteBuffer.wrap(dst); |
| | | tmpBuffer.order(ByteOrder.LITTLE_ENDIAN); |
| | | tmpBuffer.position(0); |
| | | tmpBuffer.putShort(signature); |
| | | tmpBuffer.putShort((short) ((length / 2) - 2)); |
| | | |
| | | /* |
| | | ShortBuffer sbuffer = tmpBuffer.asShortBuffer(); |
| | | |
| | | short[] rawMem = new short[(length / 2)]; |
| | | sbuffer.get(rawMem, 2, rawMem.length - 2); |
| | | rawMem[0] = signature; |
| | | rawMem[1] = (short) ((length / 2) - 2); |
| | | Element elm = createElement(rawMem); |
| | | */ |
| | | Element elm = createElement(dst); |
| | | |
| | | return elm; |
| | | } |
| | |
| | | return ((Element) element).raw.length; |
| | | } |
| | | |
| | | protected Element createElement(short[] raw) |
| | | protected Element createElement(byte[] raw) |
| | | { |
| | | return new Element(raw); |
| | | } |