Package com.esotericsoftware.kryo.io

Examples of com.esotericsoftware.kryo.io.Input


        marsh.writeObject(kryoOut, obj);
        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);
      }

      long dur = System.nanoTime() - start;
      dur = TimeUnit.NANOSECONDS.toMillis(dur);
View Full Code Here


        marsh.writeObject(kryoOut, obj);
        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);
      }

      long dur = System.nanoTime() - start;
      dur = TimeUnit.NANOSECONDS.toMillis(dur);
View Full Code Here

        marsh.writeObject(kryoOut, obj);
        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);
      }

      long dur = System.nanoTime() - start;
      dur = TimeUnit.NANOSECONDS.toMillis(dur);
View Full Code Here

        marsh.writeObject(kryoOut, obj);
        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);
      }

      long dur = System.nanoTime() - start;
      dur = TimeUnit.NANOSECONDS.toMillis(dur);
View Full Code Here

        marsh.writeObject(kryoOut, obj);
        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);
      }

      long dur = System.nanoTime() - start;
      dur = TimeUnit.NANOSECONDS.toMillis(dur);
View Full Code Here

    assertEquals(4, write.writeFloat(-65, 1000, false));
    assertEquals(4, write.writeFloat(-65, 1000, true));
    assertEquals(4, write.writeFloat(-8192, 1000, false));
    assertEquals(4, write.writeFloat(-8192, 1000, true));

    Input read = new UnsafeInput(write.toBytes());
    assertEquals(read.readFloat(), 0f);
    assertEquals(read.readFloat(), 63f);
    assertEquals(read.readFloat(), 64f);
    assertEquals(read.readFloat(), 127f);
    assertEquals(read.readFloat(), 128f);
    assertEquals(read.readFloat(), 8192f);
    assertEquals(read.readFloat(), 16384f);
    assertEquals(read.readFloat(), 32767f);
    assertEquals(read.readFloat(), -63f);
    assertEquals(read.readFloat(), -64f);
    assertEquals(read.readFloat(), -127f);
    assertEquals(read.readFloat(), -128f);
    assertEquals(read.readFloat(), -8192f);
    assertEquals(read.readFloat(), -16384f);
    assertEquals(read.readFloat(), -32768f);
    assertEquals(read.readFloat(1000, true), 0f);
    assertEquals(read.readFloat(1000, false), 0f);
    assertEquals(read.readFloat(1000, true), 63f);
    assertEquals(read.readFloat(1000, false), 63f);
    assertEquals(read.readFloat(1000, true), 64f);
    assertEquals(read.readFloat(1000, false), 64f);
    assertEquals(read.readFloat(1000, true), 127f);
    assertEquals(read.readFloat(1000, false), 127f);
    assertEquals(read.readFloat(1000, true), 128f);
    assertEquals(read.readFloat(1000, false), 128f);
    assertEquals(read.readFloat(1000, true), 8191f);
    assertEquals(read.readFloat(1000, false), 8191f);
    assertEquals(read.readFloat(1000, true), 8192f);
    assertEquals(read.readFloat(1000, false), 8192f);
    assertEquals(read.readFloat(1000, true), 16383f);
    assertEquals(read.readFloat(1000, false), 16383f);
    assertEquals(read.readFloat(1000, true), 16384f);
    assertEquals(read.readFloat(1000, false), 16384f);
    assertEquals(read.readFloat(1000, true), 32767f);
    assertEquals(read.readFloat(1000, false), 32767f);
    assertEquals(read.readFloat(1000, false), -64f);
    assertEquals(read.readFloat(1000, true), -64f);
    assertEquals(read.readFloat(1000, false), -65f);
    assertEquals(read.readFloat(1000, true), -65f);
    assertEquals(read.readFloat(1000, false), -8192f);
    assertEquals(read.readFloat(1000, true), -8192f);
  }
View Full Code Here

    assertEquals(8, write.writeDouble(-65, 1000, true));
    assertEquals(8, write.writeDouble(-8192, 1000, false));
    assertEquals(8, write.writeDouble(-8192, 1000, true));
    write.writeDouble(1.23456d);

    Input read = new UnsafeInput(write.toBytes());
    assertEquals(read.readDouble(), 0d);
    assertEquals(read.readDouble(), 63d);
    assertEquals(read.readDouble(), 64d);
    assertEquals(read.readDouble(), 127d);
    assertEquals(read.readDouble(), 128d);
    assertEquals(read.readDouble(), 8192d);
    assertEquals(read.readDouble(), 16384d);
    assertEquals(read.readDouble(), 32767d);
    assertEquals(read.readDouble(), -63d);
    assertEquals(read.readDouble(), -64d);
    assertEquals(read.readDouble(), -127d);
    assertEquals(read.readDouble(), -128d);
    assertEquals(read.readDouble(), -8192d);
    assertEquals(read.readDouble(), -16384d);
    assertEquals(read.readDouble(), -32768d);
    assertEquals(read.readDouble(1000, true), 0d);
    assertEquals(read.readDouble(1000, false), 0d);
    assertEquals(read.readDouble(1000, true), 63d);
    assertEquals(read.readDouble(1000, false), 63d);
    assertEquals(read.readDouble(1000, true), 64d);
    assertEquals(read.readDouble(1000, false), 64d);
    assertEquals(read.readDouble(1000, true), 127d);
    assertEquals(read.readDouble(1000, false), 127d);
    assertEquals(read.readDouble(1000, true), 128d);
    assertEquals(read.readDouble(1000, false), 128d);
    assertEquals(read.readDouble(1000, true), 8191d);
    assertEquals(read.readDouble(1000, false), 8191d);
    assertEquals(read.readDouble(1000, true), 8192d);
    assertEquals(read.readDouble(1000, false), 8192d);
    assertEquals(read.readDouble(1000, true), 16383d);
    assertEquals(read.readDouble(1000, false), 16383d);
    assertEquals(read.readDouble(1000, true), 16384d);
    assertEquals(read.readDouble(1000, false), 16384d);
    assertEquals(read.readDouble(1000, true), 32767d);
    assertEquals(read.readDouble(1000, false), 32767d);
    assertEquals(read.readDouble(1000, false), -64d);
    assertEquals(read.readDouble(1000, true), -64d);
    assertEquals(read.readDouble(1000, false), -65d);
    assertEquals(read.readDouble(1000, true), -65d);
    assertEquals(read.readDouble(1000, false), -8192d);
    assertEquals(read.readDouble(1000, true), -8192d);
    assertEquals(1.23456d, read.readDouble());
  }
View Full Code Here

    for (int i = 0; i < 100; i++) {
      write.writeBoolean(true);
      write.writeBoolean(false);
    }

    Input read = new UnsafeInput(write.toBytes());
    for (int i = 0; i < 100; i++) {
      assertEquals(true, read.readBoolean());
      assertEquals(false, read.readBoolean());
    }
  }
View Full Code Here

    write.writeChar((char)8192);
    write.writeChar((char)16384);
    write.writeChar((char)32767);
    write.writeChar((char)65535);

    Input read = new UnsafeInput(write.toBytes());
    assertEquals(0, read.readChar());
    assertEquals(63, read.readChar());
    assertEquals(64, read.readChar());
    assertEquals(127, read.readChar());
    assertEquals(128, read.readChar());
    assertEquals(8192, read.readChar());
    assertEquals(16384, read.readChar());
    assertEquals(32767, read.readChar());
    assertEquals(65535, read.readChar());
  }
View Full Code Here

    write.writeVarInt(65535, true);
    assertEquals(6, write.total());
    write.flush();
    assertEquals(6, os.size());

    Input read = new UnsafeInput(os.toByteArray());
    assertEquals(0, read.readVarInt(true));
    assertEquals(63, read.readVarInt(true));
    assertEquals(64, read.readVarInt(true));
    assertEquals(65535, read.readVarInt(true));
    assertEquals(true, read.eof());
  }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.io.Input

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.