Package org.apache.cassandra.io

Examples of org.apache.cassandra.io.DataInputBuffer.reset()


    }

    public static RangeSliceReply read(byte[] body) throws IOException
    {
        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(body, body.length);
        boolean completed = bufIn.readBoolean();
        int rowCount = bufIn.readInt();
        List<Row> rows = new ArrayList<Row>(rowCount);
        for (int i = 0; i < rowCount; i++)
        {
View Full Code Here


            for (Message response : responses_)
            {
                try
                {
                    byte[] body = response.getMessageBody();
                    bufIn.reset(body, body.length);
                    ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
                    byte[] digest = result.digest();
                    if (!Arrays.equals(ColumnFamily.digest(row_.cf), digest))
                    {
                        doReadRepair();
View Full Code Here

            catch (TimeoutException e)
            {
                throw new TimedOutException();
            }
            DataInputBuffer bufIn = new DataInputBuffer();
            bufIn.reset(body, body.length);
            ReadResponse response = ReadResponse.serializer().deserialize(bufIn);
            if (response.row() != null)
                rows.add(response.row());
        }
        return rows;
View Full Code Here

    public static RangeCommand read(Message message) throws IOException
    {
        byte[] bytes = message.getMessageBody();
        DataInputBuffer dib = new DataInputBuffer();
        dib.reset(bytes, bytes.length);
        return serializer.deserialize(new DataInputStream(dib));
    }

    public String toString()
    {
View Full Code Here

    public static RangeReply read(byte[] body) throws IOException
    {
        DataInputBuffer bufIn = new DataInputBuffer();
        boolean rangeCompletedLocally;       
        bufIn.reset(body, body.length);
        rangeCompletedLocally = bufIn.readBoolean();

        List<String> keys = new ArrayList<String>();
        while (bufIn.getPosition() < body.length)
        {
View Full Code Here

    public void doVerb(Message message)
    {
        byte[] bytes = message.getMessageBody();
        DataInputBuffer buffer = new DataInputBuffer();
        buffer.reset(bytes, bytes.length);

        try
        {
            RowMutation rm = RowMutation.serializer().deserialize(buffer);
            if (logger_.isDebugEnabled())
View Full Code Here

                catch (EOFException e)
                {
                    // last CL entry didn't get completely written.  that's ok.
                    break;
                }
                bufIn.reset(bytes, bytes.length);
                Checksum checksum = new CRC32();
                checksum.update(bytes, 0, bytes.length);
                if (claimedCRC32 != checksum.getValue())
                {
                    // this part of the log must not have been fsynced.  probably the rest is bad too,
View Full Code Here

        ReadCommandSerializer rms = ReadCommand.serializer();
        DataOutputBuffer dos = new DataOutputBuffer();
        DataInputBuffer dis = new DataInputBuffer();

        rms.serialize(rm, dos);
        dis.reset(dos.getData(), dos.getLength());
        return rms.deserialize(dis);
    }
   
    @Test
    public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException
View Full Code Here

        cf.addColumn(column("C", "v", 1));
        DataOutputBuffer bufOut = new DataOutputBuffer();
        ColumnFamily.serializer().serialize(cf, bufOut);

        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(bufOut.getData(), bufOut.getLength());
        cf = ColumnFamily.serializer().deserialize(bufIn);
        assert cf != null;
        assert cf.name().equals("Standard1");
        assert cf.getSortedColumns().size() == 1;
    }
View Full Code Here

        }
        ColumnFamily.serializer().serialize(cf, bufOut);

        // verify
        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(bufOut.getData(), bufOut.getLength());
        cf = ColumnFamily.serializer().deserialize(bufIn);
        for (String cName : map.navigableKeySet())
        {
            assert new String(cf.getColumn(cName.getBytes()).value()).equals(map.get(cName));
        }
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.