/** * {@inheritDoc} */ @Override public char getChar() { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { char c = componentCursor.getChar(); index += 2; return c; } else { byte b0 = get(); byte b1 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (char)((b0 << 8) | (b1 & 0xFF)); } else { return (char)((b1 << 8) | (b0 & 0xFF)); } } }
/** * {@inheritDoc} */ @Override public short getShort() { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { short s = componentCursor.getShort(); index += 2; return s; } else { byte b0 = get(); byte b1 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (short) ((b0 << 8) | (b1 & 0xFF)); } else { return (short) ((b1 << 8) | (b0 & 0xFF)); } } }
/** * {@inheritDoc} */ @Override public short getShort() { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { short s = componentCursor.getShort(); index += 2; return s; } else { byte b0 = get(); byte b1 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (short) ((b0 << 8) | (b1 & 0xFF)); } else { return (short) ((b1 << 8) | (b0 & 0xFF)); } } }
/** * @inheritDoc */ public char getChar() { prepareForAccess( 2 ); if ( componentCursor.getRemaining() >= 4 ) { char c = componentCursor.getChar(); index += 2; return c; } else { byte b0 = get(); byte b1 = get(); if ( order.equals( ByteOrder.BIG_ENDIAN ) ) { return ( char ) ( ( b0 << 8 ) | ( b1 << 0 ) ); } else { return ( char ) ( ( b1 << 8 ) | ( b0 << 0 ) ); } } }
/** * @inheritDoc */ public short getShort() { prepareForAccess( 2 ); if ( componentCursor.getRemaining() >= 4 ) { short s = componentCursor.getShort(); index += 2; return s; } else { byte b0 = get(); byte b1 = get(); if ( order.equals( ByteOrder.BIG_ENDIAN ) ) { return ( short ) ( ( b0 << 8 ) | ( b1 << 0 ) ); } else { return ( short ) ( ( b1 << 8 ) | ( b0 << 0 ) ); } } }
/** * @inheritDoc */ public int getInt() { prepareForAccess( 4 ); if ( componentCursor.getRemaining() >= 4 ) { int i = componentCursor.getInt(); index += 4; return i; } else { byte b0 = get(); byte b1 = get(); byte b2 = get(); byte b3 = get(); if ( order.equals( ByteOrder.BIG_ENDIAN ) ) { return ( ( b0 << 24 ) | ( b1 << 16 ) | ( b2 << 8 ) | ( b3 << 0 ) ); } else { return ( ( b3 << 24 ) | ( b2 << 16 ) | ( b1 << 8 ) | ( b0 << 0 ) ); } } }
/** * {@inheritDoc} */ @Override public char getChar() { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { char c = componentCursor.getChar(); index += 2; return c; } else { byte b0 = get(); byte b1 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (char)((b0 << 8) | (b1 & 0xFF)); } else { return (char)((b1 << 8) | (b0 & 0xFF)); } } }
/** * {@inheritDoc} */ @Override public int getInt() { prepareForAccess(4); if (componentCursor.getRemaining() >= 4) { int i = componentCursor.getInt(); index += 4; return i; } else { byte b0 = get(); byte b1 = get(); byte b2 = get(); byte b3 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (b0 << 24) | ((b1 & 0xFF) << 16) | ((b2 & 0xFF) << 8) | (b3 & 0xFF); } else { return (b3 << 24) | ((b2 & 0xFF) << 16) | ((b1 & 0xFF) << 8) | (b0 & 0xFF); } } }
/** * {@inheritDoc} */ @Override public int getInt() { prepareForAccess(4); if (componentCursor.getRemaining() >= 4) { int i = componentCursor.getInt(); index += 4; return i; } else { byte b0 = get(); byte b1 = get(); byte b2 = get(); byte b3 = get(); if (order.equals(ByteOrder.BIG_ENDIAN)) { return (b0 << 24) | ((b1 & 0xFF) << 16) | ((b2 & 0xFF) << 8) | (b3 & 0xFF); } else { return (b3 << 24) | ((b2 & 0xFF) << 16) | ((b1 & 0xFF) << 8) | (b0 & 0xFF); } } }