public void print(char s[]) { this.addChars(s); }
public final CharBuf add( boolean b ) { addChars ( b ? trueChars : falseChars ); return this; }
public final CharBuf add( boolean b ) { addChars ( b ? trueChars : falseChars ); return this; }
public void print(char s[]) { this.addChars(s); }
public final CharBuf add( boolean b ) { addChars ( b ? trueChars : falseChars ); return this; }
public void print(char s[]) { this.addChars(s); }
public final CharBuf addInt( Integer key ) { if (icache == null) { icache = new SimpleCache<> ( 1000, CacheType.LRU ); } char [] chars = icache.get ( key ); if ( chars == null ) { String str = Integer.toString ( key ); chars = FastStringUtils.toCharArray ( str ); icache.put ( key, chars ); } addChars ( chars ); return this; }
public final CharBuf addInt( Integer key ) { if (icache == null) { icache = new SimpleCache<> ( 1000, CacheType.LRU ); } char [] chars = icache.get ( key ); if ( chars == null ) { String str = Integer.toString ( key ); chars = FastStringUtils.toCharArray ( str ); icache.put ( key, chars ); } addChars ( chars ); return this; }
public final CharBuf addInt( Integer key ) { if (icache == null) { icache = new SimpleCache<> ( 1000, CacheType.LRU ); } char [] chars = icache.get ( key ); if ( chars == null ) { String str = Integer.toString ( key ); chars = FastStringUtils.toCharArray ( str ); icache.put ( key, chars ); } addChars ( chars ); return this; }
public final void serializeMap( Map<Object, Object> smap, CharBuf builder ) { Map map = smap; if ( map.size () == 0 ) { builder.addChars ( EMPTY_MAP_CHARS ); return; } builder.addChar( '{' ); int index=0; final Set<Map.Entry> entrySet = map.entrySet(); for ( Map.Entry entry : entrySet ) { if (entry.getValue ()!=null ) { serializeFieldName ( Str.toString(entry.getKey()), builder ); serializeObject( entry.getValue(), builder ); builder.addChar ( ',' ); index++; } } if (index>0) builder.removeLastChar (); builder.addChar( '}' ); }
@Override public final void serializeArray ( Object array, CharBuf builder ) { if ( Array.getLength (array) == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); final int length = Array.getLength( array ); for ( int index = 0; index < length; index++ ) { final Object o = Array.get(array, index); if (o == null) { builder.addNull(); builder.addChar ( ',' ); continue; } serializeObject( Array.get( array, index ), builder ); builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
public final void serializeCollection( Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); } else { serializeObject(o, builder); } builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
public final void serializeCollection( Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); } else { serializeObject(o, builder); } builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
public final void serializeCollection( Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); } else { serializeObject(o, builder); } builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
@Override public final void serializeDate( JsonSerializerInternal jsonSerializer, Date date, CharBuf builder ) { String string = dateCache.get ( date ); if ( string == null) { CharBuf buf = CharBuf.create ( Dates.JSON_TIME_LENGTH ); Dates.jsonDateChars ( calendar, date, buf ); string = buf.toString(); dateCache.put ( date, string ); } builder.addChars ( FastStringUtils.toCharArray( string ) ); } }
@Override public final void serializeCollection ( JsonSerializerInternal serializer, Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); builder.addChar ( ',' ); continue; } serializer.serializeObject(o, builder); builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
@Override public final void serializeDate( JsonSerializerInternal jsonSerializer, Date date, CharBuf builder ) { String string = dateCache.get ( date ); if ( string == null) { CharBuf buf = CharBuf.create ( Dates.JSON_TIME_LENGTH ); Dates.jsonDateChars ( calendar, date, buf ); string = buf.toString(); dateCache.put ( date, string ); } builder.addChars ( FastStringUtils.toCharArray( string ) ); } }
@Override public final void serializeCollection ( JsonSerializerInternal serializer, Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); builder.addChar ( ',' ); continue; } serializer.serializeObject(o, builder); builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }
@Override public final void serializeDate( JsonSerializerInternal jsonSerializer, Date date, CharBuf builder ) { String string = dateCache.get ( date ); if ( string == null) { CharBuf buf = CharBuf.create ( Dates.JSON_TIME_LENGTH ); Dates.jsonDateChars ( calendar, date, buf ); string = buf.toString(); dateCache.put ( date, string ); } builder.addChars ( FastStringUtils.toCharArray( string ) ); } }
@Override public final void serializeCollection ( JsonSerializerInternal serializer, Collection<?> collection, CharBuf builder ) { if ( collection.size () == 0 ) { builder.addChars ( EMPTY_LIST_CHARS ); return; } builder.addChar( '[' ); for ( Object o : collection ) { if (o == null) { builder.addNull(); builder.addChar ( ',' ); continue; } serializer.serializeObject(o, builder); builder.addChar ( ',' ); } builder.removeLastChar (); builder.addChar( ']' ); }