public static String decodeString( byte[] byteArray ) { return UTF8.decode( byteArray ); }
static String asValueRaw( byte[] byteArray, long long0 ) { return byteArray == null ? null : UTF8.decode( byteArray, 0, (int) long0 ); }
public static String getDecodedStringFrom( ByteBuffer source ) { // Currently only one key is supported although the data format supports multiple int count = source.getInt(); int remaining = source.remaining(); if ( count > remaining ) { throw badStringFormatException( count, remaining ); } byte[] data = new byte[count]; source.get( data ); return UTF8.decode( data ); }
public static String readString( ReadableChannel channel, int length ) throws IOException { assert length >= 0 : "invalid array length " + length; byte[] chars = new byte[length]; channel.get( chars, length ); return UTF8.decode( chars ); }
public List<S> deserializeRecords( byte[] bytes ) throws FormatException { return deserializeRecords( Arrays.asList( UTF8.decode( bytes ).split( "\n" ) ) ); }
private TextValue string( RecordPropertyCursor cursor, long reference, PageCursor page ) { ByteBuffer buffer = cursor.buffer = read.loadString( reference, cursor.buffer, page ); buffer.flip(); return Values.stringValue( UTF8.decode( buffer.array(), 0, buffer.limit() ) ); }
private static String entityAsString( Response response ) { byte[] bytes = (byte[]) response.getEntity(); return UTF8.decode( bytes ); }
private String decode( final Response response ) { return UTF8.decode( (byte[]) response.getEntity() ); }
@Override public Object read( ReadableClosableChannel from ) throws IOException { int length = from.getInt(); byte[] bytes = new byte[length]; // TODO wasteful from.get( bytes, length ); return UTF8.decode( bytes ); }
public static String read3bLengthAndString( ReadableChannel channel ) throws IOException { short lengthShort = channel.getShort(); byte lengthByte = channel.get(); int length = (lengthByte << 16) | (lengthShort & 0xFFFF); byte[] chars = new byte[length]; channel.get( chars, length ); return UTF8.decode( chars ); }
private String readFailure( File failureFile ) throws IOException { try ( StoreChannel channel = fs.open( failureFile, OpenMode.READ ) ) { byte[] data = new byte[(int) channel.size()]; channel.readAll( ByteBuffer.wrap( data ) ); return UTF8.decode( withoutZeros( data ) ); } }
@Test public void correctRepresentation() { Response resp = jmxService.getServiceDefinition(); assertEquals( 200, resp.getStatus() ); String json = UTF8.decode( (byte[]) resp.getEntity() ); MatcherAssert.assertThat( json, containsString( "resources" ) ); MatcherAssert.assertThat( json, containsString( uri.toString() ) ); MatcherAssert.assertThat( json, containsString( "jmx/domain/{domain}/{objectName}" ) ); }
result[i] = UTF8.decode( buffer.array(), buffer.position(), byteLength ); buffer.position( buffer.position() + byteLength );
@Override public Object get( long offset ) { int length = cache.getByte( offset++, 0 ) & 0xFF; length |= (cache.getByte( offset++, 0 ) & 0xFF) << Byte.SIZE; ByteArray array = cache.at( offset ); byte[] bytes = new byte[length]; for ( int i = 0; i < length; ) { int bytesLeftToRead = length - i; int bytesLeftInChunk = (int) (chunkSize - offset % chunkSize); int bytesToReadInThisChunk = min( bytesLeftToRead, bytesLeftInChunk ); for ( int j = 0; j < bytesToReadInThisChunk; j++ ) { bytes[i++] = array.getByte( offset++, 0 ); } if ( length > i ) { array = cache.at( offset ); } } return UTF8.decode( bytes ); }
static String asValueRaw( byte[] byteArray, long long0 ) { return byteArray == null ? null : UTF8.decode( byteArray, 0, (int) long0 ); }
assertLowest( DurationValue.duration( Period.of( Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE ) ) ); assertLowest( of( UTF8.decode( new byte[0] ) ) );
private static File unmarshalFile( ReadableChannel channel ) throws IOException { byte[] name = readBytes( channel ); return new File( UTF8.decode( name ) ); }
@Override protected void decode( ChannelHandlerContext ctx, ByteBuf msg, List<Object> out ) { int length = msg.readInt(); byte[] bytes = new byte[length]; msg.readBytes( bytes ); String name = UTF8.decode( bytes ); int requiredAlignment = msg.readInt(); out.add( new FileHeader( name, requiredAlignment ) ); } }
public static String getDecodedStringFrom( ByteBuffer source ) { // Currently only one key is supported although the data format supports multiple int count = source.getInt(); int remaining = source.remaining(); if ( count > remaining ) { throw badStringFormatException( count, remaining ); } byte[] data = new byte[count]; source.get( data ); return UTF8.decode( data ); }
private TextValue string( RecordPropertyCursor cursor, long reference, PageCursor page ) { ByteBuffer buffer = cursor.buffer = read.loadString( reference, cursor.buffer, page ); buffer.flip(); return Values.stringValue( UTF8.decode( buffer.array(), 0, buffer.limit() ) ); }