Package com.netflix.zeno.fastblob.io

Examples of com.netflix.zeno.fastblob.io.FastBlobWriter.writeSnapshot()


        stateEngine.prepareForWrite();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        FastBlobWriter writer = new FastBlobWriter(stateEngine);
        writer.writeSnapshot(baos);

        FastBlobStateEngine deserializeEngine = typeAStateEngine();

        FastBlobReader reader = new FastBlobReader(deserializeEngine);
View Full Code Here


        ByteArrayOutputStream reserializedStream = new ByteArrayOutputStream();

        FastBlobWriter rewriter = new FastBlobWriter(deserializeEngine);

        rewriter.writeSnapshot(reserializedStream);

        Assert.assertArrayEquals(baos.toByteArray(), reserializedStream.toByteArray());

        System.out.println(Arrays.toString(baos.toByteArray()));
        System.out.println(Arrays.toString(reserializedStream.toByteArray()));
View Full Code Here

        DataOutputStream dataOutputStream = new DataOutputStream(baos);

        stateEngine.prepareForWrite();

        FastBlobWriter writer = new FastBlobWriter(stateEngine);
        writer.writeSnapshot(dataOutputStream);

        FastBlobReader reader = new FastBlobReader(stateEngine);
        reader.readSnapshot(new ByteArrayInputStream(baos.toByteArray()));

        return stateEngine;
View Full Code Here

        stateEngine.prepareForWrite();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        FastBlobWriter writer = new FastBlobWriter(stateEngine);
        writer.writeSnapshot(baos);
        snapshot1 = baos.toByteArray();
        baos.reset();

        stateEngine.prepareForNextCycle();
View Full Code Here

        writer.writeDelta(baos);
        delta = baos.toByteArray();
        baos.reset();

        writer.writeSnapshot(baos);
        snapshot2 = baos.toByteArray();
        baos.reset();

        /// we also create a broken delta chain to cause ordinal reassignments.
        stateEngine = newStateEngine();
View Full Code Here

        addFs(1, 2, 4, 5, 6, 8, 9, 11, 12);

        stateEngine.prepareForWrite();

        writer = new FastBlobWriter(stateEngine);
        writer.writeSnapshot(baos);
        brokenDeltaChainSnapshot2 = baos.toByteArray();
   }

    private FastBlobStateEngine newStateEngine() {
        return new FastBlobStateEngine(new SerializerFactory() {
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream outputStream = new DataOutputStream(baos);

        try {
            /// write the snapshot to the output stream.
            writer.writeSnapshot(outputStream);
        } catch(IOException e) {
            /// the FastBlobWriter throws an IOException if it is
            /// unable to write to the provided OutputStream
        } finally {
            /// it is your responsibility to close the stream.  The FastBlobWriter will not do this.
View Full Code Here

        stateEngine.prepareForWrite();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        FastBlobWriter writer = new FastBlobWriter(stateEngine);
        writer.writeSnapshot(new DataOutputStream(baos));

        FastBlobReader reader = new FastBlobReader(stateEngine);
        reader.readSnapshot(new ByteArrayInputStream(baos.toByteArray()));

        stateEngine.prepareForNextCycle();
View Full Code Here

    private void fillDeserializationWithImage(FastBlobStateEngine serverStateEngine, FastBlobStateEngine clientStateEngine,
            int imageIndex) throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FastBlobWriter writer = new FastBlobWriter(serverStateEngine, imageIndex);
        writer.writeSnapshot(baos);

        FastBlobReader reader = new FastBlobReader(clientStateEngine);
        reader.readSnapshot(new ByteArrayInputStream(baos.toByteArray()));
    }
}
View Full Code Here

    private void serializeAndDeserialize(FastBlobStateEngine stateEngine) throws IOException {
        stateEngine.prepareForWrite();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FastBlobWriter writer = new FastBlobWriter(stateEngine, 0);
        writer.writeSnapshot(new DataOutputStream(baos));
        FastBlobReader reader = new FastBlobReader(stateEngine);
        reader.readSnapshot(new ByteArrayInputStream(baos.toByteArray()));
    }

    /**
 
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.