Package com.esotericsoftware.kryo.io

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


    write.writeString(value);
    Input read = new Input(write.toBytes());
    assertEquals(value, read.readString());
    assertEquals(value, read.readStringBuilder().toString());

    write.clear();
    write.writeString(buffer);
    write.writeString(buffer);
    read = new Input(write.toBytes());
    assertEquals(value, read.readStringBuilder().toString());
    assertEquals(value, read.readString());
View Full Code Here


    read = new Input(write.toBytes());
    assertEquals(value, read.readStringBuilder().toString());
    assertEquals(value, read.readString());

    if (length <= 127) {
      write.clear();
      write.writeAscii(value);
      write.writeAscii(value);
      read = new Input(write.toBytes());
      assertEquals(value, read.readStringBuilder().toString());
      assertEquals(value, read.readString());
View Full Code Here

    kryo.register(D.class);
    kryo.register(E.class);
    kryo.register(F.class);
    kryo.setRegistrationRequired(true);

    output.clear();
    kryo.writeClassAndObject(output, c);
    output.flush();
    assertEquals(14, output.total());

    Input input = new Input(output.getBuffer());
View Full Code Here

    String value = "abcdef\u00E1\u00E9\u00ED\u00F3\u00FA\u1234";
    write.writeString(value);
    Input read = new Input(write.toBytes());
    assertEquals(value, read.readString());

    write.clear();
    write.writeString(null);
    read = new Input(write.toBytes());
    assertEquals(null, read.readString());

    for (int i = 0; i <= 258; i++)
View Full Code Here

    write.writeString(value);
    Input read = new Input(write.toBytes());
    assertEquals(value, read.readString());
    assertEquals(value, read.readStringBuilder().toString());

    write.clear();
    write.writeString(buffer);
    write.writeString(buffer);
    read = new Input(write.toBytes());
    assertEquals(value, read.readStringBuilder().toString());
    assertEquals(value, read.readString());
View Full Code Here

    read = new Input(write.toBytes());
    assertEquals(value, read.readStringBuilder().toString());
    assertEquals(value, read.readString());

    if (length <= 127) {
      write.clear();
      write.writeAscii(value);
      write.writeAscii(value);
      read = new Input(write.toBytes());
      assertEquals(value, read.readStringBuilder().toString());
      assertEquals(value, read.readString());
View Full Code Here

    kryo.register(D.class);
    kryo.register(E.class);
    kryo.register(F.class);
    kryo.setRegistrationRequired(true);

    output.clear();
    kryo.writeClassAndObject(output, c);
    output.flush();
    assertEquals(14, output.total());

    Input input = new Input(output.getBuffer());
View Full Code Here

    }

    @Override
    public byte[] write(Object object) {
        final Output out = getOutput();
        out.clear();
        kryo.writeClassAndObject(out, object);
        out.flush();
        return out.toBytes();
    }
View Full Code Here

    }

    @Override
    public void write(OutputStream os, Object object) {
        final Output out = getOutput();
        out.clear();
        out.setOutputStream(os);
        kryo.writeClassAndObject(out, object);
        out.flush();
        out.setOutputStream(null);
    }
View Full Code Here

      {
        LOG.error("Kryo wasn't able to serialize: '{}'", object);
      }

      // release the memory for the buffer
      buffer.clear();
      buffer = null;

      return data;
    } finally {
      System.runFinalization();
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.