/** * Write medium string. * * @param s the s */ public void writeMediumString( String s ) { final byte[] bytes = DynamicByteBufferHelper.bytes( s ); this.addUnsignedShort( bytes.length ); this.add( bytes ); }
/** * Write small string. * * @param s the s */ public void writeSmallString( String s ) { final byte[] bytes = DynamicByteBufferHelper.bytes( s ); this.addUnsignedByte( ( short ) bytes.length ); this.add( bytes ); }
/** * Normalize first word. * * @param word the word * @return the string */ private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
/** * Package-private non-final implementation of andThen() so only we can * override it. * * @param <C> * the generic type * @param secondConverter * the second converter * @return the converter */ <C> Converter<A, C> doAndThen(Converter<B, C> secondConverter) { return new ConverterComposition<A, B, C>(this, checkNotNull(secondConverter)); }
/** * Do write short array. * * @param values the values * @param byteSize the byte size */ private void doWriteShortArray( short[] values, int byteSize ) { if ( !( byteSize + length < capacity ) ) { buffer = DynamicByteBufferHelper.grow( buffer, buffer.length * 2 + byteSize ); } for ( int index = 0; index < values.length; index++ ) { this.add( values[ index ] ); } }
/** * Converts the specified {@code String str} from this format to the specified {@code format}. A * "best effort" approach is taken; if {@code str} does not conform to the assumed format, then * the behavior of this method is undefined but we make a reasonable effort at converting anyway. * * @param format the format * @param str the str * @return the string */ public final String to(CaseFormat format, String str) { checkNotNull(format); checkNotNull(str); return (format == this) ? str : convert(format, str); }
/** * Instantiates a new or. * * @param a the a * @param b the b */ Or(CharMatcher a, CharMatcher b) { first = checkNotNull(a); second = checkNotNull(b); }
@Override public CharMatcher negate() { return new NegatedFastMatcher(this); } }
/** * If the argument is an {@linkplain #isUpperCase(char) uppercase ASCII character} returns the * lowercase equivalent. Otherwise returns the argument. * * @param c the c * @return the char */ public static char toLowerCase(char c) { return isUpperCase(c) ? (char) (c ^ 0x20) : c; }
/** * Write medium string. * * @param s the s */ public void writeMediumString( String s ) { final byte[] bytes = DynamicByteBufferHelper.bytes( s ); this.addUnsignedShort( bytes.length ); this.add( bytes ); }
/** * Write small string. * * @param s the s */ public void writeSmallString( String s ) { final byte[] bytes = DynamicByteBufferHelper.bytes( s ); this.addUnsignedByte( ( short ) bytes.length ); this.add( bytes ); }
/** * Normalize first word. * * @param word the word * @return the string */ private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
/** * Package-private non-final implementation of andThen() so only we can * override it. * * @param <C> * the generic type * @param secondConverter * the second converter * @return the converter */ <C> Converter<A, C> doAndThen(Converter<B, C> secondConverter) { return new ConverterComposition<A, B, C>(this, checkNotNull(secondConverter)); }
/** * Do write float array. * * @param values the values * @param byteSize the byte size */ private void doWriteFloatArray( float[] values, int byteSize ) { if ( !( byteSize + length < capacity ) ) { buffer = DynamicByteBufferHelper.grow( buffer, buffer.length * 2 + byteSize ); } for ( int index = 0; index < values.length; index++ ) { this.add( values[ index ] ); } }