Examples of FSTObjectOutput


Examples of de.ruedigermoeller.serialization.FSTObjectOutput

            return EMPTY_BYTES;

        try {
            @Cleanup
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            FSTObjectOutput oos = conf.getObjectOutput(os);
            oos.writeObject(graph);
            oos.flush();

            return os.toByteArray();
        } catch (Exception e) {
            log.warn("Fail to serializer graph. graph=" + graph, e);
            return EMPTY_BYTES;
View Full Code Here

Examples of de.ruedigermoeller.serialization.FSTObjectOutput

  {
    Exception exception = null;

    try
    {
      FSTObjectOutput out = fastSerializationConfig.getObjectOutput();

      if (listener != null)
      {
        out.setListener(new ListenerAdapter(listener));
        listener.begin(object);
      }
      out.writeObject(object);
      out.setListener(null);

      return out.getCopyOfWrittenBuffer();
    }
    catch (Exception e)
    {
      exception = e;
      throw new FastWicketSerialException(String.format(
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

        conf.registerCrossPlatformClassMapping( new String[][] {
                        {"senum", "ser.Basics$SampleEnum"},
                        {"special", "ser.Basics$SpecialEnum"},
                }
        );
        out = new FSTObjectOutput(conf);
        in = new FSTObjectInput(conf);
    }
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

        @Test
        public void testCustomSerializer() throws Exception {
                FSTConfiguration FST = FSTConfiguration.createDefaultConfiguration();
                //FST.setForceSerializable(true);
                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());
        }
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

            return dummy;
        }
    }

    public void exceptionTest(FSTConfiguration conf) throws IOException, ClassNotFoundException {
        FSTObjectOutput out = conf.getObjectOutput();
        Exception e;
        try {
            throw new Exception("Test");
        } catch (Exception ex) {
            e = ex;
        }
        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);
    }
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

            exceptionTest(conf);

            ToWrite w = new ToWrite("bla");

            byte b[] = null;
            FSTObjectOutput out = new FSTObjectOutput(conf);
            out.writeObject(w);
            out.flush();
            b = out.getBuffer();

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

Examples of org.nustaq.serialization.FSTObjectOutput

    protected FSTObjectOutput out;
    protected FSTObjectInput in;
   
    @org.junit.Before
    public void setUp() throws Exception {
        out = new FSTObjectOutput();
        in = new FSTObjectInput();
    }
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

    }

    @Test
    public void testFlush() throws IOException, ClassNotFoundException {
        ByteArrayOutputStream bout = new ByteArrayOutputStream(1000*1000);
        FSTObjectOutput fout = new FSTObjectOutput(bout);
        Strings obj = new Strings();
        fout.writeObject(obj);
        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();
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

    public void fastRoundTrip()
        throws IOException, ClassNotFoundException {
        TestArray list = new TestArray();

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        FSTObjectOutput objOut = new FSTObjectOutput(os);
        objOut.writeObject(list);
        objOut.close();

        ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
        FSTObjectInput objIn = new FSTObjectInput(is);
//        objIn.setReadExternalReadAHead(16000);
        TestArray res = (TestArray) objIn.readObject();
View Full Code Here

Examples of org.nustaq.serialization.FSTObjectOutput

        Holder holder = new Holder();
        holder.o = new ToRead("foo");
        holder.o2 = holder.o;

        byte[] b = null;
        FSTObjectOutput out = new FSTObjectOutput(conf);
        out.writeObject(holder);
        out.flush();
        b = out.getBuffer();

        FSTObjectInput in = new FSTObjectInput(conf);
        in.resetForReuseUseArray(b,b.length);
        Object res = in.readObject();
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.