@Override public void writeByte( byte v ) { this.addByte( v ); }
@Override public void writeByte( byte v ) { this.addByte( v ); }
@Override public void write( int b ) { this.addByte( b ); }
@Override public void write( int b ) { this.addByte( b ); }
@Override public void writeByte( byte v ) { this.addByte( v ); }
@Override public void write( int b ) { this.addByte( b ); }
@Test public void readUnsignedInt () { //0x53, 0x2D, 0x78, 0xAA. //http://stackoverflow.com/questions/19874527/conversion-from-bytes-to-large-unsigned-integer-and-string ByteBuf buf = ByteBuf.create ( 20 ); buf.addByte ( 0xAA ); buf.addByte ( 0x78 ); buf.addByte ( 0x2D ); buf.addByte ( 0x53 ); byte[] bytes = buf.readForRecycle ();
public ByteBuf addUrlEncodedByteArray( byte[] value ) { final byte[] encoded = new byte[ 2 ]; for ( int index = 0; index < value.length; index++ ) { int i = value[ index ]; if ( i >= 'a' && i <= 'z' ) { this.addByte( i ); } else if ( i >= 'A' && i <= 'Z' ) { this.addByte( i ); } else if ( i >= '0' && i <= '9' ) { this.addByte( i ); } else if ( i == '_' || i == '-' || i == '.' || i == '*' ) { this.addByte( i ); } else if ( i == ' ' ) { this.addByte( '+' ); } else { ByteScanner.encodeByteIntoTwoAsciiCharBytes( i, encoded ); this.addByte( '%' ); this.addByte( encoded[ 0 ] ); this.addByte( encoded[ 1 ] ); } } return this; }
public ByteBuf addUrlEncodedByteArray( byte[] value ) { final byte[] encoded = new byte[ 2 ]; for ( int index = 0; index < value.length; index++ ) { int i = value[ index ]; if ( i >= 'a' && i <= 'z' ) { this.addByte( i ); } else if ( i >= 'A' && i <= 'Z' ) { this.addByte( i ); } else if ( i >= '0' && i <= '9' ) { this.addByte( i ); } else if ( i == '_' || i == '-' || i == '.' || i == '*' ) { this.addByte( i ); } else if ( i == ' ' ) { this.addByte( '+' ); } else { ByteScanner.encodeByteIntoTwoAsciiCharBytes( i, encoded ); this.addByte( '%' ); this.addByte( encoded[ 0 ] ); this.addByte( encoded[ 1 ] ); } } return this; }
public ByteBuf addUrlEncodedByteArray( byte[] value ) { final byte[] encoded = new byte[ 2 ]; for ( int index = 0; index < value.length; index++ ) { int i = value[ index ]; if ( i >= 'a' && i <= 'z' ) { this.addByte( i ); } else if ( i >= 'A' && i <= 'Z' ) { this.addByte( i ); } else if ( i >= '0' && i <= '9' ) { this.addByte( i ); } else if ( i == '_' || i == '-' || i == '.' || i == '*' ) { this.addByte( i ); } else if ( i == ' ' ) { this.addByte( '+' ); } else { ByteScanner.encodeByteIntoTwoAsciiCharBytes( i, encoded ); this.addByte( '%' ); this.addByte( encoded[ 0 ] ); this.addByte( encoded[ 1 ] ); } } return this; }
this.addByte( '"' ); this.addByte( '\\' ); this.addByte( '"' ); break; this.addByte( '\\' ); this.addByte( '\\' ); break; this.addByte( '\\' ); this.addByte( '/' ); break; this.addByte( '\\' ); this.addByte( 'n' ); break; this.addByte( '\\' ); this.addByte( 't' ); break; this.addByte( '\\' ); this.addByte( 'r' ); break; this.addByte( '\\' ); this.addByte( 'b' ); break;