/** * @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 */ public float getFloat() { prepareForAccess( 4 ); if ( componentCursor.getRemaining() >= 4 ) { float f = componentCursor.getFloat(); index += 4; return f; } else { int i = getInt(); return Float.intBitsToFloat( i ); } }
/** * @inheritDoc */ public double getDouble() { prepareForAccess( 8 ); if ( componentCursor.getRemaining() >= 4 ) { double d = componentCursor.getDouble(); index += 8; return d; } else { long l = getLong(); return Double.longBitsToDouble( l ); } }
prepareForAccess( 4 ); if ( componentCursor.getRemaining() >= 4 ) b3 = ( byte ) ( ( i >> 24 ) & 0xff ); put( b0 ); put( b1 ); put( b2 ); put( b3 );
prepareForAccess(8); } else { if (order.equals(ByteOrder.BIG_ENDIAN)) { put((byte) ((l >> 56) & 0xff)); put((byte) ((l >> 48) & 0xff)); put((byte) ((l >> 40) & 0xff)); put((byte) ((l >> 32) & 0xff)); put((byte) ((l >> 24) & 0xff)); put((byte) ((l >> 16) & 0xff)); put((byte) ((l >> 8) & 0xff)); put((byte) (l & 0xff)); } else { put((byte) (l & 0xff)); put((byte) ((l >> 8) & 0xff)); put((byte) ((l >> 16) & 0xff)); put((byte) ((l >> 24) & 0xff)); put((byte) ((l >> 32) & 0xff)); put((byte) ((l >> 40) & 0xff)); put((byte) ((l >> 48) & 0xff)); put((byte) ((l >> 56) & 0xff));
/** * @inheritDoc */ public void putShort( short s ) { prepareForAccess( 2 ); if ( componentCursor.getRemaining() >= 4 ) { componentCursor.putShort( s ); index += 2; } else { byte b0; byte b1; if ( order.equals( ByteOrder.BIG_ENDIAN ) ) { b0 = ( byte ) ( ( s >> 8 ) & 0xff ); b1 = ( byte ) ( ( s >> 0 ) & 0xff ); } else { b0 = ( byte ) ( ( s >> 0 ) & 0xff ); b1 = ( byte ) ( ( s >> 8 ) & 0xff ); } put( b0 ); put( b1 ); } }
/** * @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 ) ); } } }
prepareForAccess(8); } else { if (order.equals(ByteOrder.BIG_ENDIAN)) { put((byte) ((l >> 56) & 0xff)); put((byte) ((l >> 48) & 0xff)); put((byte) ((l >> 40) & 0xff)); put((byte) ((l >> 32) & 0xff)); put((byte) ((l >> 24) & 0xff)); put((byte) ((l >> 16) & 0xff)); put((byte) ((l >> 8) & 0xff)); put((byte) (l & 0xff)); } else { put((byte) (l & 0xff)); put((byte) ((l >> 8) & 0xff)); put((byte) ((l >> 16) & 0xff)); put((byte) ((l >> 24) & 0xff)); put((byte) ((l >> 32) & 0xff)); put((byte) ((l >> 40) & 0xff)); put((byte) ((l >> 48) & 0xff)); put((byte) ((l >> 56) & 0xff));
/** * @inheritDoc */ public void putChar( char c ) { prepareForAccess( 2 ); if ( componentCursor.getRemaining() >= 4 ) { componentCursor.putChar( c ); index += 2; } else { byte b0; byte b1; if ( order.equals( ByteOrder.BIG_ENDIAN ) ) { b0 = ( byte ) ( ( c >> 8 ) & 0xff ); b1 = ( byte ) ( ( c >> 0 ) & 0xff ); } else { b0 = ( byte ) ( ( c >> 0 ) & 0xff ); b1 = ( byte ) ( ( c >> 8 ) & 0xff ); } put( b0 ); put( b1 ); } }
/** * {@inheritDoc} */ @Override public void putChar(char c) { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { componentCursor.putChar(c); index += 2; } else { byte b0; byte b1; if (order.equals(ByteOrder.BIG_ENDIAN)) { b0 = (byte) ((c >> 8) & 0xff); b1 = (byte) (c & 0xff); } else { b0 = (byte) (c & 0xff); b1 = (byte) ((c >> 8) & 0xff); } put(b0); put(b1); } }
/** * {@inheritDoc} */ @Override public void putInt(int i) { prepareForAccess(4); if (componentCursor.getRemaining() >= 4) { componentCursor.putInt(i); index += 4; } else { if (order.equals(ByteOrder.BIG_ENDIAN)) { put((byte) ((i >> 24) & 0xff)); put((byte) ((i >> 16) & 0xff)); put((byte) ((i >> 8) & 0xff)); put((byte) (i & 0xff)); } else { put((byte) (i & 0xff)); put((byte) ((i >> 8) & 0xff)); put((byte) ((i >> 16) & 0xff)); put((byte) ((i >> 24) & 0xff)); } } }
/** * {@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 void putInt(int i) { prepareForAccess(4); if (componentCursor.getRemaining() >= 4) { componentCursor.putInt(i); index += 4; } else { if (order.equals(ByteOrder.BIG_ENDIAN)) { put((byte) ((i >> 24) & 0xff)); put((byte) ((i >> 16) & 0xff)); put((byte) ((i >> 8) & 0xff)); put((byte) (i & 0xff)); } else { put((byte) (i & 0xff)); put((byte) ((i >> 8) & 0xff)); put((byte) ((i >> 16) & 0xff)); put((byte) ((i >> 24) & 0xff)); } } }
/** * {@inheritDoc} */ @Override public void putChar(char c) { prepareForAccess(2); if (componentCursor.getRemaining() >= 4) { componentCursor.putChar(c); index += 2; } else { byte b0; byte b1; if (order.equals(ByteOrder.BIG_ENDIAN)) { b0 = (byte) ((c >> 8) & 0xff); b1 = (byte) (c & 0xff); } else { b0 = (byte) (c & 0xff); b1 = (byte) ((c >> 8) & 0xff); } put(b0); put(b1); } }
/** * {@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); } } }