final FixedPoint fp = FixedPoint.parse( "12392,4412", ',' );
ByteArrayOutputStream baos = null;
ByteArrayInputStream bais = null;
DataOutputStream dos = null;
DataInputStream dis = null;
SerializerOutputStream out = null;
SerializerInputStream in = null;
try
{
baos = new ByteArrayOutputStream();
dos = new DataOutputStream( baos );
out = new SerializerOutputStream( dos );
FixedPoint.serialize( out, fp, false );
FixedPoint.serialize( out, fp, true );
FixedPoint.serialize( out, null, true );
bais = new ByteArrayInputStream( baos.toByteArray() );
dis = new DataInputStream( bais );
in = new SerializerInputStream( dis );
final FixedPoint fp1 = FixedPoint.deserialize( in, false );
assertTrue( fp.equals( fp1 ) );
final FixedPoint fp2 = FixedPoint.deserialize( in, true );
assertTrue( fp.equals( fp2 ) );
final FixedPoint fp3 = FixedPoint.deserialize( in, true );
assertNull( fp3 );
}
catch( SerializationException e )
{
fail( e.getMessage() );
}
finally
{
try{ out.close(); }catch( Exception e ){}
try{ dos.close(); }catch( Exception e ){}
try{ baos.close(); }catch( Exception e ){}
try{ in.close(); }catch( Exception e ){}
try{ dis.close(); }catch( Exception e ){}
try{ bais.close(); }catch( Exception e ){}