Package com.esotericsoftware.kryo.io

Examples of com.esotericsoftware.kryo.io.Output.position()


    });

    Output output = new Output(512, -1);
    kryo.writeObject(output, stuff);

    Input input = new Input(output.getBuffer(), 0, output.position());
    Stuff stuff2 = kryo.readObject(input, Stuff.class);

    assertEquals(stuff.ordering.order, stuff2.ordering.order);
    assertEquals(stuff.get("key"), stuff2.get("key"));
    assertEquals(stuff.get("something"), stuff2.get("something"));
View Full Code Here


        }

        Input kryoIn = null;

        try {
          kryoIn = new Input(kryoOut.getBuffer(), 0, kryoOut.position());
          newObj = marsh.readObject(kryoIn, SampleObject.class);
        } finally {
          kryoIn.close();
          // U.close(kryoIn, null);
        }
View Full Code Here

        }

        Input kryoIn = null;

        try {
          kryoIn = new Input(kryoOut.getBuffer(), 0, kryoOut.position());
          newObj = marsh.readObject(kryoIn, SampleObject.class);
        } finally {
          // U.close(kryoIn, null);
          kryoIn.close();
        }
View Full Code Here

        kryoOut.close();
        // U.close(kryoOut, null);

        Input kryoIn = null;

        kryoIn = new Input(kryoOut.getBuffer(), 0, kryoOut.position());

        newObj = marsh.readObject(kryoIn, SampleObject.class);
        kryoIn.close();
        // U.close(kryoIn, null);
      }
View Full Code Here

        kryoOut.close();
        // U.close(kryoOut, null);

        Input kryoIn = null;

        kryoIn = new FastInput(kryoOut.getBuffer(), 0, kryoOut.position());

        newObj = marsh.readObject(kryoIn, SampleObject.class);
        kryoIn.close();
        // U.close(kryoIn, null);
      }
View Full Code Here

        kryoOut.close();
        // U.close(kryoOut, null);

        Input kryoIn = null;

        kryoIn = new UnsafeInput(kryoOut.getBuffer(), 0, kryoOut.position());

        newObj = marsh.readObject(kryoIn, SampleObject.class);
        kryoIn.close();
        // U.close(kryoIn, null);
      }
View Full Code Here

        kryoOut.close();
        // U.close(kryoOut, null);

        Input kryoIn = null;

        kryoIn = new UnsafeInput(kryoOut.getBuffer(), 0, kryoOut.position());

        newObj = marsh.readObject(kryoIn, SampleObject.class);
        kryoIn.close();
        // U.close(kryoIn, null);
      }
View Full Code Here

        kryoOut.close();
        // U.close(kryoOut, null);

        Input kryoIn = null;

        kryoIn = new UnsafeInput(kryoOut.getBuffer(), 0, kryoOut.position());

        newObj = marsh.readObject(kryoIn, SampleObject.class);
        kryoIn.close();
        // U.close(kryoIn, null);
      }
View Full Code Here

  public void test_measurepoint_save(){
    Kryo kryo = SerializeUtil.createKryo();
    Output output = new Output(66666);
   
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    int oldPos = output.position();
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    assertEquals(oldPos+19,output.position());//only key is written not string again
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    kryo.writeClassAndObject(output, new MeasurePointData("2222"));
    kryo.writeClassAndObject(output, new MeasurePointData("2222"));
View Full Code Here

    Output output = new Output(66666);
   
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    int oldPos = output.position();
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    assertEquals(oldPos+19,output.position());//only key is written not string again
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
    kryo.writeClassAndObject(output, new MeasurePointData("2222"));
    kryo.writeClassAndObject(output, new MeasurePointData("2222"));
    kryo.writeClassAndObject(output, new MeasurePointData("1111"));
   
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.