@Override public char readChar() { char value = Byt.idxChar( array, location ); location += 2; return value; }
public ByteBuf add( final byte[] array, final int length ) { if ( ( this.length + length ) < capacity ) { Byt._idx( buffer, this.length, array, length ); } else { buffer = Byt.grow( buffer, buffer.length * 2 + length ); capacity = buffer.length; Byt._idx( buffer, length, array, length ); } this.length += length; return this; }
byte[] bytes = bytes( new byte[]{ 0x01, 0x02, 0x03 } ); bytes = add( bytes, ( byte ) 0x04 ); bytes = addInt( bytes, 1 ); len( bytes ) == 8 || die( "length should be 8" ); idxInt( bytes, 4 ) == 1 || die( "read int back as 1" ); bytes = addLong( bytes, 0xFFFEFAFBFCL ); len( bytes ) == 16 || die( "length should be 16" ); idxLong( bytes, 8 ) == 0xFFFEFAFBFCL || die( "read int back as 0xFFFEFAFBFCL" ); bytes = addShort( bytes, ( short ) 0x0FED ); len( bytes ) == 18 || die( "length should be 18" ); idxShort( bytes, 16 ) == 0x0FED || die( "read shor back as 0x0FED" ); bytes = addChar( bytes, 'a' ); len( bytes ) == 20 || die( "length should be 20" ); idxChar( bytes, 18 ) == 'a' || die( "read char back as 'a'" ); bytes = addFloat( bytes, 99.00f );
double myDouble; myByte = idx( bytes, 0 ); myShort = idxShort( bytes, 1 ); myChar = idxChar( bytes, 3 ); myInt = idxInt( bytes, 5 ); myFloat = idxFloat( bytes, 9 ); myLong = idxLong( bytes, 13 ); myDouble = idxDouble( bytes, 21 ); myDouble = idxDouble( bytes, 21 ); worked |= myDouble == 7 || die( "value was 7" );
public ByteBuf add( String str ) { this.add( Byt.bytes( str ) ); return this; }
@Override public byte readByte() { byte value = Byt.idx( array, location ); location += 1; return value; }
long val = idxUnsignedInt( bytes, 0 ); val = idxLong( bytes, 0 ); val = idxUnsignedInt( bytes, 0 ); val = idxUnsignedInt( bytes2, 0 ); unsignedIntTo( bytes3, 0, 2860002643L ); val = idxUnsignedInt( bytes2, 0 );
if ( c == split ) { results[ resultIndex ] = Byt.copy( inputArray, startCurrentLineIndex, currentLineLength - 1 ); startCurrentLineIndex = index + 1; //skip the byte if ( !Byt.inIntArray( c, delims ) ) { results[ resultIndex ] = Byt.copy( inputArray, startCurrentLineIndex, currentLineLength - 1 ); resultIndex++;
@Override public int readInt() { int value = Byt.idxInt( array, location ); location += 4; return value; }
@Override public long readLong() { long value = Byt.idxLong( array, location ); location += 8; return value; }