@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();
    assertTrue(res == res1);
    assertTrue(DeepEquals.deepEquals(obj, res));
  }
  @Test
  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();
    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);
    }
    assertTrue(res.bytes1[547] == 1 && res.bytes2[347] == 2);
  }