litesoft
@ 942
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
package org.litesoft.codec; import org.litesoft.commonfoundation.charstreams.*; import org.litesoft.commonfoundation.annotations.*; import org.litesoft.commonfoundation.typeutils.*; public class PrimitiveIntegerCodec { public static final PrimitiveIntegerCodec SIGNED = new PrimitiveIntegerCodec( PrimitiveLongCodec.SIGNED ); public static final PrimitiveIntegerCodec NON_NEGATIVE = new PrimitiveIntegerCodec( PrimitiveLongCodec.NON_NEGATIVE ); private final PrimitiveLongCodec mPrimitiveCodec; private PrimitiveIntegerCodec( PrimitiveLongCodec pPrimitiveCodec ) { mPrimitiveCodec = pPrimitiveCodec; } public void encode( @NotNull CharSink pCharSink, int pValue ) { mPrimitiveCodec.encode( pCharSink, pValue ); } public int decode( @NotNull CharSource pCharSource ) { return Integers.intValue( mPrimitiveCodec.decode( pCharSource ) ); } } |