Package org.nustaq.serialization

Examples of org.nustaq.serialization.FSTObjectInput.readObject()


                FST.registerSerializer(Bug34.NonSerializableClass.class, new Serializer(), false);
                FSTObjectOutput out = FST.getObjectOutput();
                out.writeObject(new Bug34.NonSerializableClass());

                FSTObjectInput in = FST.getObjectInput(out.getCopyOfWrittenBuffer());
                assertEquals(NonSerializableClass.class, in.readObject().getClass());
        }

        private static class Serializer extends FSTBasicObjectSerializer {

                @Override
View Full Code Here


        }
        out.writeObject(e);
        out.flush();
        FSTObjectInput in = new FSTObjectInput(conf);
        in.resetForReuseUseArray(out.getBuffer(),out.getWritten());
        Object ex = in.readObject();
        System.out.println("success "+ex);
    }

    public void test( FSTConfiguration conf, Serializable toTest ) {
        byte b[] = conf.asByteArray(toTest);
View Full Code Here

            out.flush();
            b = out.getBuffer();

            FSTObjectInput in = new FSTObjectInput(conf);
            in.resetForReuseUseArray(b, b.length);
            Object res = in.readObject();

            if (!res.equals("bla")) {
                throw new RuntimeException("fail " + res);
            }
View Full Code Here

        fout.writeObject(new byte[1000*1000*10]);
        fout.writeObject(obj);
        fout.close();

        FSTObjectInput fin = new FSTObjectInput(new ByteArrayInputStream(bout.toByteArray()));
        Strings res = (Strings) fin.readObject();
        fin.readObject();
        Strings res1 = (Strings) fin.readObject();
        assertTrue(res == res1);
        assertTrue(DeepEquals.deepEquals(obj,res));
    }
View Full Code Here

        fout.writeObject(obj);
        fout.close();

        FSTObjectInput fin = new FSTObjectInput(new ByteArrayInputStream(bout.toByteArray()));
        Strings res = (Strings) fin.readObject();
        fin.readObject();
        Strings res1 = (Strings) fin.readObject();
        assertTrue(res == res1);
        assertTrue(DeepEquals.deepEquals(obj,res));
    }
View Full Code Here

        fout.close();

        FSTObjectInput fin = new FSTObjectInput(new ByteArrayInputStream(bout.toByteArray()));
        Strings res = (Strings) fin.readObject();
        fin.readObject();
        Strings res1 = (Strings) fin.readObject();
        assertTrue(res == res1);
        assertTrue(DeepEquals.deepEquals(obj,res));
    }

    public static class SubClassedAList extends ArrayList implements Externalizable {
View Full Code Here

        objOut.close();

        ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
        FSTObjectInput objIn = new FSTObjectInput(is);
//        objIn.setReadExternalReadAHead(16000);
        TestArray res = (TestArray) objIn.readObject();
        for (int i = 0; i < res.bytes1.length; i++) {
            assertTrue(res.bytes1[i] == 1);
        }
        for (int i = 0; i < res.bytes2.length; i++) {
            assertTrue(res.bytes2[i] == 2);
View Full Code Here

        out.flush();
        b = out.getBuffer();

        FSTObjectInput in = new FSTObjectInput(conf);
        in.resetForReuseUseArray(b,b.length);
        Object res = in.readObject();

        checkEquals(Holder.class, res.getClass());
        checkEquals(String.class, ((Holder) res).o.getClass());
        checkEquals("foo", ((Holder) res).o);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.