Package org.apache.cassandra.utils.vint

Examples of org.apache.cassandra.utils.vint.EncodedDataOutputStream


    @Test
    public void testStreams() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);

        ByteArrayOutputStream byteArrayOStream2 = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(byteArrayOStream2);
       
        for (short i = 0; i < 10000; i++)
        {
            out.writeShort(i);
            odos.writeShort(i);
        }
        out.flush();
        odos.flush();

        for (int i = Short.MAX_VALUE; i < ((int)Short.MAX_VALUE + 10000); i++)
        {
            out.writeInt(i);
            odos.writeInt(i);
        }
        out.flush();
        odos.flush();

        for (long i = Integer.MAX_VALUE; i < ((long)Integer.MAX_VALUE + 10000);i++)
        {
            out.writeLong(i);
            odos.writeLong(i);
        }
        out.flush();
        odos.flush();
        Assert.assertTrue(byteArrayOStream1.size() < byteArrayOStream2.size());

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream idis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
View Full Code Here


    @Test
    public void testCFSerialization() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
        ColumnFamily.serializer.serialize(createCF(), odos, version);

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream odis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
        ColumnFamily cf = ColumnFamily.serializer.deserialize(odis, version);
View Full Code Here

    @Test
    public void testCounterCFSerialization() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
        ColumnFamily.serializer.serialize(createCounterCF(), odos, version);

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream odis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
        ColumnFamily cf = ColumnFamily.serializer.deserialize(odis, version);
View Full Code Here

            return null;
        }

        try
        {
            serializer.serialize(value, new EncodedDataOutputStream(new MemoryOutputStream(freeableMemory)));
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

            return null;
        }

        try
        {
            serializer.serialize(value, new EncodedDataOutputStream(new MemoryOutputStream(freeableMemory)));
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

    @Test
    public void testStreams() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);

        ByteArrayOutputStream byteArrayOStream2 = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(byteArrayOStream2);
       
        for (short i = 0; i < 10000; i++)
        {
            out.writeShort(i);
            odos.writeShort(i);
        }
        out.flush();
        odos.flush();

        for (int i = Short.MAX_VALUE; i < ((int)Short.MAX_VALUE + 10000); i++)
        {
            out.writeInt(i);
            odos.writeInt(i);
        }
        out.flush();
        odos.flush();

        for (long i = Integer.MAX_VALUE; i < ((long)Integer.MAX_VALUE + 10000);i++)
        {
            out.writeLong(i);
            odos.writeLong(i);
        }
        out.flush();
        odos.flush();
        Assert.assertTrue(byteArrayOStream1.size() < byteArrayOStream2.size());

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream idis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
View Full Code Here

    @Test
    public void testCFSerialization() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
        ColumnFamily.serializer.serialize(createCF(), odos, version);

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream odis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
        ColumnFamily cf = ColumnFamily.serializer.deserialize(odis, version);
View Full Code Here

    public void testCounterCFSerialization() throws IOException
    {
        ColumnFamily counterCF = createCounterCF();

        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
        ColumnFamily.serializer.serialize(counterCF, odos, version);

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream odis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
        ColumnFamily cf = ColumnFamily.serializer.deserialize(odis, version);
View Full Code Here

            return null;
        }

        try
        {
            serializer.serialize(value, new EncodedDataOutputStream(new MemoryOutputStream(freeableMemory)));
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

    @Test
    public void testStreams() throws IOException
    {
        ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
        EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);

        ByteArrayOutputStream byteArrayOStream2 = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(byteArrayOStream2);
       
        for (short i = 0; i < 10000; i++)
        {
            dos.writeShort(i);
            odos.writeShort(i);
        }
        dos.flush();
        odos.flush();

        for (int i = Short.MAX_VALUE; i < ((int)Short.MAX_VALUE + 10000); i++)
        {
            dos.writeInt(i);
            odos.writeInt(i);
        }
        dos.flush();
        odos.flush();

        for (long i = Integer.MAX_VALUE; i < ((long)Integer.MAX_VALUE + 10000);i++)
        {
            dos.writeLong(i);
            odos.writeLong(i);
        }
        dos.flush();
        odos.flush();
        Assert.assertTrue(byteArrayOStream1.size() < byteArrayOStream2.size());

        ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
        EncodedDataInputStream idis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
View Full Code Here

TOP

Related Classes of org.apache.cassandra.utils.vint.EncodedDataOutputStream

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.