public static byte[][] splitByCharsNoneEmpty( byte[] inputArray, char... delims ) { final byte[][] results = splitByChars( inputArray, delims ); return compact( results ); }
/** * Turn a single bytes into two hex character representation. * * @param decoded the byte to serializeObject. * @param encoded the array to which each encoded nibbles are now ascii hex representations. */ public static void encodeByteIntoTwoAsciiCharBytes( final int decoded, final byte[] encoded ) { encoded[ 0 ] = ( byte ) encodeNibbleToHexAsciiCharByte( ( decoded >> 4 ) & 0x0F ); encoded[ 1 ] = ( byte ) encodeNibbleToHexAsciiCharByte( decoded & 0x0F ); }
protected String exceptionDetails( String message ) { return ByteScanner.errorDetails(message, charArray, __index, __currentChar); }
public static byte[][] splitByCharsNoneEmpty( final byte[] inputArray, int from, int to, final byte... delims ) { final byte[][] results = splitByCharsFromToDelims( inputArray, from, to, delims ); return compact( results ); }
_buffer[_location] = '0'; _location ++; ByteScanner.encodeByteIntoTwoAsciiCharBytes( c, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b; ByteScanner.encodeByteIntoTwoAsciiCharBytes( charByte, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b;
protected final String decodeString() { byte[] array = charArray; int index = __index; int currentChar = array[index]; if ( index < array.length && currentChar == DOUBLE_QUOTE ) { index++; } final int startIndex = index; boolean encoded = ByteScanner.hasEscapeCharUTF8(array, index, indexHolder); index = indexHolder[0]; String value = null; if ( encoded ) { index = ByteScanner.findEndQuoteUTF8( array, index); value = builder.decodeJsonString ( array, startIndex, index ).toString (); builder.recycle (); } else { value = new String( array, startIndex, ( index - startIndex ) ); } if ( index < charArray.length ) { index++; } __index = index; return value; }
boolean encoded = ByteScanner.hasEscapeChar(array, index, indexHolder); index = indexHolder[0]; index = ByteScanner.findEndQuote ( array, index); value = builder.decodeJsonString ( array, startIndex, index ).toString (); builder.recycle ();
if ( actualLength < resultsArrayLength ) { final int newSize = resultsArrayLength - actualLength; results = __shrink( results, newSize );
@Test public void autoSplitThisByTabOrSpace() { byte[] letters = bytes( "This\tis a string" ); byte[][] splitted = ByteScanner.splitByChars( letters, '\t', ' ' ); assertEquals( 4, splitted.length ); assertArrayEquals( bytes( "This" ), splitted[ 0 ] ); assertArrayEquals( bytes( "is" ), splitted[ 1 ] ); assertArrayEquals( bytes( "a" ), splitted[ 2 ] ); assertArrayEquals( bytes( "string" ), splitted[ 3 ] ); assertArrayEquals( new byte[][]{ bytes( "This" ), bytes( "is" ), bytes( "a" ), bytes( "string" ) }, splitted ); }
public static byte[][] splitByCharsNoneEmpty( final byte[] inputArray, int from, int to, final byte... delims ) { final byte[][] results = splitByCharsFromToDelims( inputArray, from, to, delims ); return compact( results ); }
_buffer[_location] = '0'; _location ++; ByteScanner.encodeByteIntoTwoAsciiCharBytes( c, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b; ByteScanner.encodeByteIntoTwoAsciiCharBytes( charByte, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b;
protected final String decodeString() { byte[] array = charArray; int index = __index; int currentChar = array[index]; if ( index < array.length && currentChar == DOUBLE_QUOTE ) { index++; } final int startIndex = index; boolean encoded = ByteScanner.hasEscapeCharUTF8(array, index, indexHolder); index = indexHolder[0]; String value = null; if ( encoded ) { index = ByteScanner.findEndQuoteUTF8( array, index); value = builder.decodeJsonString ( array, startIndex, index ).toString (); builder.recycle (); } else { value = new String( array, startIndex, ( index - startIndex ) ); } if ( index < charArray.length ) { index++; } __index = index; return value; }
boolean encoded = ByteScanner.hasEscapeChar(array, index, indexHolder); index = indexHolder[0]; index = ByteScanner.findEndQuote ( array, index); value = builder.decodeJsonString ( array, startIndex, index ).toString (); builder.recycle ();
if ( actualLength < resultsArrayLength ) { final int newSize = resultsArrayLength - actualLength; results = __shrink( results, newSize );
public static byte[][] splitByCharsNoneEmpty( byte[] inputArray, char... delims ) { final byte[][] results = splitByChars( inputArray, delims ); return compact( results ); }
public static byte[][] splitByCharsNoneEmpty( final byte[] inputArray, int from, int to, final byte... delims ) { final byte[][] results = splitByCharsFromToDelims( inputArray, from, to, delims ); return compact( results ); }
_buffer[_location] = '0'; _location ++; ByteScanner.encodeByteIntoTwoAsciiCharBytes( c, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b; ByteScanner.encodeByteIntoTwoAsciiCharBytes( charByte, _encoded ); for (int b : _encoded) { _buffer [_location] = (char)b;