Package bm.core.io

Examples of bm.core.io.SerializerOutputStream


                   RSException
    {
        try
        {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream dos = new SerializerOutputStream( baos );
            dos.writeByte( Constants.DBRT_TABLE_INFO );
            info.serialize( dos );
            open();
            final byte[] data = baos.toByteArray();
            rs.setRecord( info.getRecordId(), data, 0, data.length );
        }
View Full Code Here


        open();
        final Log log = Database.log;
        try
        {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream out = new SerializerOutputStream( baos );
            header.serialize( out );
            final byte[] data = baos.toByteArray();
            final Store rs = this.rs;
            if( rs.getNumRecords() == 0 )
            {
View Full Code Here

        System.out.println( "Writing index" );
        final ZOutputStream zos = new ZOutputStream(
                os,
                ZStream.Z_BEST_COMPRESSION
        );
        final SerializerOutputStream out = new SerializerOutputStream( zos );

        final int numRecords;
        try
        {
            index.getRecordStore().open();
        }
        catch( RecordStoreFullException e )
        {
            throw new RSException( 0, e );
        }
        final Store rs = index.getRecordStore();
        out.writeInt( index.getOrder() );
        out.writeByte( (byte) index.getType() );
        out.writeBoolean( index.isCaseSensitive() );
        numRecords = rs.getNumRecords();
        System.out.println( "Writing " + numRecords + " records" );
        out.writeInt( numRecords );
        for( int i = 1; i <= numRecords; i++ )
        {
            try
            {
                out.writeBlob( rs.getRecord( i ) );
            }
            catch( InvalidRecordIDException e )
            {
            }
        }
        out.flush();
        zos.flush();
        zos.close();
        System.out.println( "Done" );
    }
View Full Code Here

            row.setField( "tLong", new Long( 15 ) );
            final byte[] data = "HelloWorld".getBytes();
            row.setField( "tBlob", data );

            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream out = new SerializerOutputStream( baos );

            // Serialization no longer throws RequiredFieldCantBeNullException
//            try
//            {
//                row.serialize( out );
View Full Code Here

        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 ){}
View Full Code Here

            throw new InvalidRecordIDException( Constants.ERR_TBL_STORE_UPDATE );
        }
        try
        {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream out = new SerializerOutputStream( baos );
            open();
            row.serialize( out );
            final byte[] data = baos.toByteArray();
            rs.setRecord(
                    row.getRecordId().intValue(),
View Full Code Here

                baseId = LoginManager.getDeviceNumber() * -100000;
                row.setId( baseId - mustBeRecordId );
            }

            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream out = new SerializerOutputStream( baos );
            row.serialize( out );
            final byte[] data = baos.toByteArray();
            final int recordId = rs.addRecord( data, 0, data.length );
            row.setRecordId( new Integer( recordId ) );
            if( generateId && recordId != mustBeRecordId )
View Full Code Here

    {
        RecordStore rs = null;
        try
        {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            final SerializerOutputStream out = new SerializerOutputStream( baos );
            serialize( out );
            final byte[] data = baos.toByteArray();
            rs = RecordStore.openRecordStore( RS_NAME, true );
            if( rs.getNumRecords() == 0 )
            {
View Full Code Here

                baos.reset();
            }
            else
            {
                baos = new ByteArrayOutputStream();
                out = new SerializerOutputStream( baos );
            }
            serialize( out );
            final byte[] data = baos.toByteArray();
            if( recordId != null )
            {
View Full Code Here

        {
            assertNull( record.items[i] );
        }

        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final SerializerOutputStream out = new SerializerOutputStream( baos );

        try
        {
            record.serialize( out );
View Full Code Here

TOP

Related Classes of bm.core.io.SerializerOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.