cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [4/5] cassandra git commit: Switch to DataInputPlus
Date Thu, 02 Jul 2015 08:40:28 GMT
http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
index 902f1c4..da8d55d 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cassandra.db.commitlog;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.EOFException;
 import java.io.File;
@@ -36,7 +35,6 @@ import com.google.common.collect.Multimap;
 import com.google.common.collect.Ordering;
 
 import org.apache.commons.lang3.StringUtils;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,9 +51,9 @@ import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.io.compress.ICompressor;
 import org.apache.cassandra.io.util.ByteBufferDataInput;
-import org.apache.cassandra.io.util.FastByteArrayInputStream;
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.io.util.NIODataInputStream;
 import org.apache.cassandra.io.util.RandomAccessReader;
 import org.apache.cassandra.utils.CRC32Factory;
 import org.apache.cassandra.utils.FBUtilities;
@@ -193,7 +191,7 @@ public class CommitLogReplayer
         }
         return end;
     }
-    
+
     abstract static class ReplayFilter
     {
         public abstract Iterable<PartitionUpdate> filter(Mutation mutation);
@@ -476,9 +474,9 @@ public class CommitLogReplayer
     {
 
         final Mutation mutation;
-        try (FastByteArrayInputStream bufIn = new FastByteArrayInputStream(inputBuffer, 0, size))
+        try (NIODataInputStream bufIn = new NIODataInputStream(inputBuffer, 0, size))
         {
-            mutation = Mutation.serializer.deserialize(new DataInputStream(bufIn),
+            mutation = Mutation.serializer.deserialize(bufIn,
                                                        desc.getMessagingVersion(),
                                                        SerializationHelper.Flag.LOCAL);
             // doublecheck that what we read is [still] valid for the current schema

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java b/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java
index 2f7ee3a..28416f3 100644
--- a/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java
+++ b/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.db.commitlog;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.util.Comparator;
 
@@ -28,6 +27,7 @@ import com.google.common.collect.Ordering;
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.ISerializer;
 import org.apache.cassandra.io.sstable.format.SSTableReader;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 public class ReplayPosition implements Comparable<ReplayPosition>
@@ -130,14 +130,14 @@ public class ReplayPosition implements Comparable<ReplayPosition>
             out.writeInt(rp.position);
         }
 
-        public ReplayPosition deserialize(DataInput in) throws IOException
+        public ReplayPosition deserialize(DataInputPlus in) throws IOException
         {
             return new ReplayPosition(in.readLong(), in.readInt());
         }
 
-        public long serializedSize(ReplayPosition rp, TypeSizes typeSizes)
+        public long serializedSize(ReplayPosition rp)
         {
-            return typeSizes.sizeof(rp.segment) + typeSizes.sizeof(rp.position);
+            return TypeSizes.sizeof(rp.segment) + TypeSizes.sizeof(rp.position);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/context/CounterContext.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/context/CounterContext.java b/src/java/org/apache/cassandra/db/context/CounterContext.java
index 2a6c5ff..9076817 100644
--- a/src/java/org/apache/cassandra/db/context/CounterContext.java
+++ b/src/java/org/apache/cassandra/db/context/CounterContext.java
@@ -75,10 +75,10 @@ import org.apache.cassandra.utils.*;
  */
 public class CounterContext
 {
-    private static final int HEADER_SIZE_LENGTH = TypeSizes.NATIVE.sizeof(Short.MAX_VALUE);
-    private static final int HEADER_ELT_LENGTH = TypeSizes.NATIVE.sizeof(Short.MAX_VALUE);
-    private static final int CLOCK_LENGTH = TypeSizes.NATIVE.sizeof(Long.MAX_VALUE);
-    private static final int COUNT_LENGTH = TypeSizes.NATIVE.sizeof(Long.MAX_VALUE);
+    private static final int HEADER_SIZE_LENGTH = TypeSizes.sizeof(Short.MAX_VALUE);
+    private static final int HEADER_ELT_LENGTH = TypeSizes.sizeof(Short.MAX_VALUE);
+    private static final int CLOCK_LENGTH = TypeSizes.sizeof(Long.MAX_VALUE);
+    private static final int COUNT_LENGTH = TypeSizes.sizeof(Long.MAX_VALUE);
     private static final int STEP_LENGTH = CounterId.LENGTH + CLOCK_LENGTH + COUNT_LENGTH;
 
     private static final Logger logger = LoggerFactory.getLogger(CounterContext.class);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/AbstractClusteringIndexFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/AbstractClusteringIndexFilter.java b/src/java/org/apache/cassandra/db/filter/AbstractClusteringIndexFilter.java
index 46d10df..29ea7fe 100644
--- a/src/java/org/apache/cassandra/db/filter/AbstractClusteringIndexFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/AbstractClusteringIndexFilter.java
@@ -58,7 +58,7 @@ public abstract class AbstractClusteringIndexFilter implements ClusteringIndexFi
     }
 
     protected abstract void serializeInternal(DataOutputPlus out, int version) throws IOException;
-    protected abstract long serializedSizeInternal(int version, TypeSizes sizes);
+    protected abstract long serializedSizeInternal(int version);
 
     protected void appendOrderByToCQLString(CFMetaData metadata, StringBuilder sb)
     {
@@ -96,10 +96,9 @@ public abstract class AbstractClusteringIndexFilter implements ClusteringIndexFi
         {
             AbstractClusteringIndexFilter filter = (AbstractClusteringIndexFilter)pfilter;
 
-            TypeSizes sizes = TypeSizes.NATIVE;
             return 1
-                 + sizes.sizeof(filter.isReversed())
-                 + filter.serializedSizeInternal(version, sizes);
+                 + TypeSizes.sizeof(filter.isReversed())
+                 + filter.serializedSizeInternal(version);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java b/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
index 1839d3e..5e6c87b 100644
--- a/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
@@ -246,12 +246,12 @@ public class ClusteringIndexNamesFilter extends AbstractClusteringIndexFilter
             Clustering.serializer.serialize(clustering, out, version, comparator.subtypes());
     }
 
-    protected long serializedSizeInternal(int version, TypeSizes sizes)
+    protected long serializedSizeInternal(int version)
     {
         long size = 0;
         ClusteringComparator comparator = (ClusteringComparator)clusterings.comparator();
         for (Clustering clustering : clusterings)
-            size += Clustering.serializer.serializedSize(clustering, version, comparator.subtypes(), sizes);
+            size += Clustering.serializer.serializedSize(clustering, version, comparator.subtypes());
         return size;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/ClusteringIndexSliceFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ClusteringIndexSliceFilter.java b/src/java/org/apache/cassandra/db/filter/ClusteringIndexSliceFilter.java
index 9e58542..8fb319e 100644
--- a/src/java/org/apache/cassandra/db/filter/ClusteringIndexSliceFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/ClusteringIndexSliceFilter.java
@@ -163,9 +163,9 @@ public class ClusteringIndexSliceFilter extends AbstractClusteringIndexFilter
         Slices.serializer.serialize(slices, out, version);
     }
 
-    protected long serializedSizeInternal(int version, TypeSizes sizes)
+    protected long serializedSizeInternal(int version)
     {
-        return Slices.serializer.serializedSize(slices, version, sizes);
+        return Slices.serializer.serializedSize(slices, version);
     }
 
     private static class SliceDeserializer extends InternalDeserializer

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/ColumnFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ColumnFilter.java b/src/java/org/apache/cassandra/db/filter/ColumnFilter.java
index 99140ef..1dc239f 100644
--- a/src/java/org/apache/cassandra/db/filter/ColumnFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/ColumnFilter.java
@@ -413,22 +413,22 @@ public class ColumnFilter
             return new ColumnFilter(isFetchAll, isFetchAll ? metadata : null, selection, subSelections);
         }
 
-        public long serializedSize(ColumnFilter selection, int version, TypeSizes sizes)
+        public long serializedSize(ColumnFilter selection, int version)
         {
             long size = 1; // header byte
 
             if (selection.selection != null)
             {
-                size += Columns.serializer.serializedSize(selection.selection.statics, sizes);
-                size += Columns.serializer.serializedSize(selection.selection.regulars, sizes);
+                size += Columns.serializer.serializedSize(selection.selection.statics);
+                size += Columns.serializer.serializedSize(selection.selection.regulars);
             }
 
             if (selection.subSelections != null)
             {
 
-                size += sizes.sizeof((short)selection.subSelections.size());
+                size += TypeSizes.sizeof((short)selection.subSelections.size());
                 for (ColumnSubselection subSel : selection.subSelections.values())
-                    size += ColumnSubselection.serializer.serializedSize(subSel, version, sizes);
+                    size += ColumnSubselection.serializer.serializedSize(subSel, version);
             }
 
             return size;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java b/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java
index 35db6f2..652e27c 100644
--- a/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java
+++ b/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java
@@ -208,23 +208,23 @@ public abstract class ColumnSubselection
             throw new AssertionError();
         }
 
-        public long serializedSize(ColumnSubselection subSel, int version, TypeSizes sizes)
+        public long serializedSize(ColumnSubselection subSel, int version)
         {
             long size = 0;
 
             ColumnDefinition column = subSel.column();
-            size += sizes.sizeofWithShortLength(column.name.bytes);
+            size += TypeSizes.sizeofWithShortLength(column.name.bytes);
             size += 1; // kind
             switch (subSel.kind())
             {
                 case SLICE:
                     Slice slice = (Slice)subSel;
-                    size += column.cellPathSerializer().serializedSize(slice.from, sizes);
-                    size += column.cellPathSerializer().serializedSize(slice.to, sizes);
+                    size += column.cellPathSerializer().serializedSize(slice.from);
+                    size += column.cellPathSerializer().serializedSize(slice.to);
                     break;
                 case ELEMENT:
                     Element element = (Element)subSel;
-                    size += column.cellPathSerializer().serializedSize(element.element, sizes);
+                    size += column.cellPathSerializer().serializedSize(element.element);
                     break;
             }
             return size;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/DataLimits.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/DataLimits.java b/src/java/org/apache/cassandra/db/filter/DataLimits.java
index 42bfa4e..76e29ec 100644
--- a/src/java/org/apache/cassandra/db/filter/DataLimits.java
+++ b/src/java/org/apache/cassandra/db/filter/DataLimits.java
@@ -705,28 +705,27 @@ public abstract class DataLimits
 
         public long serializedSize(DataLimits limits, int version)
         {
-            TypeSizes sizes = TypeSizes.NATIVE;
-            long size = sizes.sizeof((byte)limits.kind().ordinal());
+            long size = TypeSizes.sizeof((byte)limits.kind().ordinal());
             switch (limits.kind())
             {
                 case CQL_LIMIT:
                 case CQL_PAGING_LIMIT:
                     CQLLimits cqlLimits = (CQLLimits)limits;
-                    size += sizes.sizeof(cqlLimits.rowLimit);
-                    size += sizes.sizeof(cqlLimits.perPartitionLimit);
-                    size += sizes.sizeof(cqlLimits.isDistinct);
+                    size += TypeSizes.sizeof(cqlLimits.rowLimit);
+                    size += TypeSizes.sizeof(cqlLimits.perPartitionLimit);
+                    size += TypeSizes.sizeof(cqlLimits.isDistinct);
                     if (limits.kind() == Kind.CQL_PAGING_LIMIT)
                     {
                         CQLPagingLimits pagingLimits = (CQLPagingLimits)cqlLimits;
-                        size += ByteBufferUtil.serializedSizeWithShortLength(pagingLimits.lastReturnedKey, sizes);
-                        size += sizes.sizeof(pagingLimits.lastReturnedKeyRemaining);
+                        size += ByteBufferUtil.serializedSizeWithShortLength(pagingLimits.lastReturnedKey);
+                        size += TypeSizes.sizeof(pagingLimits.lastReturnedKeyRemaining);
                     }
                     break;
                 case THRIFT_LIMIT:
                 case SUPER_COLUMN_COUNTING_LIMIT:
                     ThriftLimits thriftLimits = (ThriftLimits)limits;
-                    size += sizes.sizeof(thriftLimits.partitionLimit);
-                    size += sizes.sizeof(thriftLimits.cellPerPartitionLimit);
+                    size += TypeSizes.sizeof(thriftLimits.partitionLimit);
+                    size += TypeSizes.sizeof(thriftLimits.cellPerPartitionLimit);
                     break;
                 default:
                     throw new AssertionError();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/filter/RowFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/RowFilter.java b/src/java/org/apache/cassandra/db/filter/RowFilter.java
index aff8d16..d357756 100644
--- a/src/java/org/apache/cassandra/db/filter/RowFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/RowFilter.java
@@ -452,25 +452,24 @@ public abstract class RowFilter implements Iterable<RowFilter.Expression>
 
             public long serializedSize(Expression expression, int version)
             {
-                TypeSizes sizes = TypeSizes.NATIVE;
-                long size = ByteBufferUtil.serializedSizeWithShortLength(expression.column().name.bytes, sizes)
+                long size = ByteBufferUtil.serializedSizeWithShortLength(expression.column().name.bytes)
                           + expression.operator.serializedSize();
 
                 switch (expression.kind())
                 {
                     case SIMPLE:
-                        size += ByteBufferUtil.serializedSizeWithShortLength(((SimpleExpression)expression).value, sizes);
+                        size += ByteBufferUtil.serializedSizeWithShortLength(((SimpleExpression)expression).value);
                         break;
                     case MAP_EQUALITY:
                         MapEqualityExpression mexpr = (MapEqualityExpression)expression;
                         if (version < MessagingService.VERSION_30)
-                            size += ByteBufferUtil.serializedSizeWithShortLength(mexpr.getIndexValue(), sizes);
+                            size += ByteBufferUtil.serializedSizeWithShortLength(mexpr.getIndexValue());
                         else
-                            size += ByteBufferUtil.serializedSizeWithShortLength(mexpr.key, sizes)
-                                  + ByteBufferUtil.serializedSizeWithShortLength(mexpr.value, sizes);
+                            size += ByteBufferUtil.serializedSizeWithShortLength(mexpr.key)
+                                  + ByteBufferUtil.serializedSizeWithShortLength(mexpr.value);
                         break;
                     case THRIFT_DYN_EXPR:
-                        size += ByteBufferUtil.serializedSizeWithShortLength(((ThriftExpression)expression).value, sizes);
+                        size += ByteBufferUtil.serializedSizeWithShortLength(((ThriftExpression)expression).value);
                         break;
                 }
                 return size;
@@ -773,9 +772,8 @@ public abstract class RowFilter implements Iterable<RowFilter.Expression>
 
         public long serializedSize(RowFilter filter, int version)
         {
-            TypeSizes sizes = TypeSizes.NATIVE;
             long size = 1 // forThrift
-                      + sizes.sizeof((short)filter.expressions.size());
+                      + TypeSizes.sizeof((short)filter.expressions.size());
             for (Expression expr : filter.expressions)
                 size += Expression.serializer.serializedSize(expr, version);
             return size;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/marshal/AbstractType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/AbstractType.java b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
index b074b34..78ead36 100644
--- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java
+++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
@@ -328,12 +328,12 @@ public abstract class AbstractType<T> implements Comparator<ByteBuffer>
             ByteBufferUtil.writeWithLength(value, out);
     }
 
-    public long writtenLength(ByteBuffer value, TypeSizes sizes)
+    public long writtenLength(ByteBuffer value)
     {
         assert value.hasRemaining();
         return valueLengthIfFixed() >= 0
              ? value.remaining()
-             : sizes.sizeofWithLength(value);
+             : TypeSizes.sizeofWithLength(value);
     }
 
     public ByteBuffer readValue(DataInput in) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/marshal/CollectionType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CollectionType.java b/src/java/org/apache/cassandra/db/marshal/CollectionType.java
index 0b00b47..a850305 100644
--- a/src/java/org/apache/cassandra/db/marshal/CollectionType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CollectionType.java
@@ -25,7 +25,6 @@ import java.util.Iterator;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.cql3.CQL3Type;
 import org.apache.cassandra.cql3.ColumnSpecification;
@@ -245,9 +244,9 @@ public abstract class CollectionType<T> extends AbstractType<T>
             return CellPath.create(ByteBufferUtil.readWithLength(in));
         }
 
-        public long serializedSize(CellPath path, TypeSizes sizes)
+        public long serializedSize(CellPath path)
         {
-            return sizes.sizeofWithLength(path.get(0));
+            return TypeSizes.sizeofWithLength(path.get(0));
         }
 
         public void skip(DataInput in) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/partitions/ArrayBackedCachedPartition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/partitions/ArrayBackedCachedPartition.java b/src/java/org/apache/cassandra/db/partitions/ArrayBackedCachedPartition.java
index 68b3970..bec8056 100644
--- a/src/java/org/apache/cassandra/db/partitions/ArrayBackedCachedPartition.java
+++ b/src/java/org/apache/cassandra/db/partitions/ArrayBackedCachedPartition.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.db.partitions;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -26,6 +25,7 @@ import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.rows.*;
 import org.apache.cassandra.io.ISerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.net.MessagingService;
 
@@ -216,7 +216,7 @@ public class ArrayBackedCachedPartition extends ArrayBackedPartition implements
             }
         }
 
-        public CachedPartition deserialize(DataInput in) throws IOException
+        public CachedPartition deserialize(DataInputPlus in) throws IOException
         {
             // Note that it would be slightly simpler to just do
             //   ArrayBackedCachedPiartition.create(UnfilteredRowIteratorSerializer.serializer.deserialize(...));
@@ -240,15 +240,15 @@ public class ArrayBackedCachedPartition extends ArrayBackedPartition implements
             return partition;
         }
 
-        public long serializedSize(CachedPartition partition, TypeSizes sizes)
+        public long serializedSize(CachedPartition partition)
         {
             assert partition instanceof ArrayBackedCachedPartition;
             ArrayBackedCachedPartition p = (ArrayBackedCachedPartition)partition;
 
             try (UnfilteredRowIterator iter = p.sliceableUnfilteredIterator())
             {
-                return sizes.sizeof(p.createdAtInSec)
-                     + UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, MessagingService.current_version, p.rows, sizes);
+                return TypeSizes.sizeof(p.createdAtInSec)
+                     + UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, MessagingService.current_version, p.rows);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java b/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
index ca1e424..f4195c1 100644
--- a/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
+++ b/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
@@ -17,24 +17,25 @@
  */
 package org.apache.cassandra.db.partitions;
 
-import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.*;
 
 import com.google.common.collect.Iterables;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.ColumnFilter;
 import org.apache.cassandra.db.rows.*;
 import org.apache.cassandra.db.index.SecondaryIndexManager;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.io.util.DataOutputPlus;
+import org.apache.cassandra.io.util.NIODataInputStream;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
@@ -142,7 +143,7 @@ public class PartitionUpdate extends AbstractPartitionData implements Sorting.So
 
         try
         {
-            return serializer.deserialize(new DataInputStream(ByteBufferUtil.inputStream(bytes)),
+            return serializer.deserialize(new NIODataInputStream(bytes, true),
                                           version,
                                           SerializationHelper.Flag.LOCAL,
                                           version < MessagingService.VERSION_30 ? key : null);
@@ -644,7 +645,7 @@ public class PartitionUpdate extends AbstractPartitionData implements Sorting.So
             }
         }
 
-        public PartitionUpdate deserialize(DataInput in, int version, SerializationHelper.Flag flag, DecoratedKey key) throws IOException
+        public PartitionUpdate deserialize(DataInputPlus in, int version, SerializationHelper.Flag flag, DecoratedKey key) throws IOException
         {
             if (version < MessagingService.VERSION_30)
             {
@@ -691,7 +692,7 @@ public class PartitionUpdate extends AbstractPartitionData implements Sorting.So
             return upd;
         }
 
-        public long serializedSize(PartitionUpdate update, int version, TypeSizes sizes)
+        public long serializedSize(PartitionUpdate update, int version)
         {
             if (version < MessagingService.VERSION_30)
             {
@@ -699,11 +700,11 @@ public class PartitionUpdate extends AbstractPartitionData implements Sorting.So
                 throw new UnsupportedOperationException("Version is " + version);
                 //if (cf == null)
                 //{
-                //    return typeSizes.sizeof(false);
+                //    return TypeSizes.sizeof(false);
                 //}
                 //else
                 //{
-                //    return typeSizes.sizeof(true)  /* nullness bool */
+                //    return TypeSizes.sizeof(true)  /* nullness bool */
                 //        + cfIdSerializedSize(cf.id(), typeSizes, version)  /* id */
                 //        + contentSerializedSize(cf, typeSizes, version);
                 //}
@@ -711,7 +712,7 @@ public class PartitionUpdate extends AbstractPartitionData implements Sorting.So
 
             try (UnfilteredRowIterator iter = update.sliceableUnfilteredIterator())
             {
-                return UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, version, update.rows, sizes);
+                return UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, version, update.rows);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/rows/CellPath.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/CellPath.java b/src/java/org/apache/cassandra/db/rows/CellPath.java
index 8233ac2..40d525c 100644
--- a/src/java/org/apache/cassandra/db/rows/CellPath.java
+++ b/src/java/org/apache/cassandra/db/rows/CellPath.java
@@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
 import java.security.MessageDigest;
 import java.util.Objects;
 
-import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 /**
@@ -88,7 +87,7 @@ public abstract class CellPath
     {
         public void serialize(CellPath path, DataOutputPlus out) throws IOException;
         public CellPath deserialize(DataInput in) throws IOException;
-        public long serializedSize(CellPath path, TypeSizes sizes);
+        public long serializedSize(CellPath path);
         public void skip(DataInput in) throws IOException;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/rows/RowStats.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/RowStats.java b/src/java/org/apache/cassandra/db/rows/RowStats.java
index 1bffdbe..c672490 100644
--- a/src/java/org/apache/cassandra/db/rows/RowStats.java
+++ b/src/java/org/apache/cassandra/db/rows/RowStats.java
@@ -217,12 +217,12 @@ public class RowStats
             out.writeInt(stats.avgColumnSetPerRow);
         }
 
-        public int serializedSize(RowStats stats, TypeSizes sizes)
+        public int serializedSize(RowStats stats)
         {
-            return sizes.sizeof(stats.minTimestamp)
-                 + sizes.sizeof(stats.minLocalDeletionTime)
-                 + sizes.sizeof(stats.minTTL)
-                 + sizes.sizeof(stats.avgColumnSetPerRow);
+            return TypeSizes.sizeof(stats.minTimestamp)
+                 + TypeSizes.sizeof(stats.minLocalDeletionTime)
+                 + TypeSizes.sizeof(stats.minTTL)
+                 + TypeSizes.sizeof(stats.avgColumnSetPerRow);
         }
 
         public RowStats deserialize(DataInput in) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorSerializer.java b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorSerializer.java
index 13c09d4..a4cfda7 100644
--- a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorSerializer.java
+++ b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorSerializer.java
@@ -137,7 +137,7 @@ public class UnfilteredRowIteratorSerializer
 
     // Please note that this consume the iterator, and as such should not be called unless we have a simple way to
     // recreate an iterator for both serialize and serializedSize, which is mostly only PartitionUpdate
-    public long serializedSize(UnfilteredRowIterator iterator, int version, int rowEstimate, TypeSizes sizes)
+    public long serializedSize(UnfilteredRowIterator iterator, int version, int rowEstimate)
     {
         SerializationHeader header = new SerializationHeader(iterator.metadata(),
                                                              iterator.columns(),
@@ -145,8 +145,8 @@ public class UnfilteredRowIteratorSerializer
 
         assert rowEstimate >= 0;
 
-        long size = CFMetaData.serializer.serializedSize(iterator.metadata(), version, sizes)
-                  + sizes.sizeofWithLength(iterator.partitionKey().getKey())
+        long size = CFMetaData.serializer.serializedSize(iterator.metadata(), version)
+                  + TypeSizes.sizeofWithLength(iterator.partitionKey().getKey())
                   + 1; // flags
 
         if (iterator.isEmpty())
@@ -156,20 +156,20 @@ public class UnfilteredRowIteratorSerializer
         Row staticRow = iterator.staticRow();
         boolean hasStatic = staticRow != Rows.EMPTY_STATIC_ROW;
 
-        size += SerializationHeader.serializer.serializedSizeForMessaging(header, sizes, hasStatic);
+        size += SerializationHeader.serializer.serializedSizeForMessaging(header, hasStatic);
 
         if (!partitionDeletion.isLive())
-            size += delTimeSerializedSize(partitionDeletion, header, sizes);
+            size += delTimeSerializedSize(partitionDeletion, header);
 
         if (hasStatic)
-            size += UnfilteredSerializer.serializer.serializedSize(staticRow, header, version, sizes);
+            size += UnfilteredSerializer.serializer.serializedSize(staticRow, header, version);
 
         if (rowEstimate >= 0)
-            size += sizes.sizeof(rowEstimate);
+            size += TypeSizes.sizeof(rowEstimate);
 
         while (iterator.hasNext())
-            size += UnfilteredSerializer.serializer.serializedSize(iterator.next(), header, version, sizes);
-        size += UnfilteredSerializer.serializer.serializedSizeEndOfPartition(sizes);
+            size += UnfilteredSerializer.serializer.serializedSize(iterator.next(), header, version);
+        size += UnfilteredSerializer.serializer.serializedSizeEndOfPartition();
 
         return size;
     }
@@ -246,10 +246,10 @@ public class UnfilteredRowIteratorSerializer
         out.writeInt(header.encodeDeletionTime(dt.localDeletionTime()));
     }
 
-    public static long delTimeSerializedSize(DeletionTime dt, SerializationHeader header, TypeSizes sizes)
+    public static long delTimeSerializedSize(DeletionTime dt, SerializationHeader header)
     {
-        return sizes.sizeof(header.encodeTimestamp(dt.markedForDeleteAt()))
-             + sizes.sizeof(header.encodeDeletionTime(dt.localDeletionTime()));
+        return TypeSizes.sizeof(header.encodeTimestamp(dt.markedForDeleteAt()))
+             + TypeSizes.sizeof(header.encodeDeletionTime(dt.localDeletionTime()));
     }
 
     public static DeletionTime readDelTime(DataInput in, SerializationHeader header) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
index a5a0c75..30923c5 100644
--- a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
+++ b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java
@@ -226,14 +226,14 @@ public class UnfilteredSerializer
         }
     }
 
-    public long serializedSize(Unfiltered unfiltered, SerializationHeader header, int version, TypeSizes sizes)
+    public long serializedSize(Unfiltered unfiltered, SerializationHeader header, int version)
     {
         return unfiltered.kind() == Unfiltered.Kind.RANGE_TOMBSTONE_MARKER
-             ? serializedSize((RangeTombstoneMarker) unfiltered, header, version, sizes)
-             : serializedSize((Row) unfiltered, header, version, sizes);
+             ? serializedSize((RangeTombstoneMarker) unfiltered, header, version)
+             : serializedSize((Row) unfiltered, header, version);
     }
 
-    public long serializedSize(Row row, SerializationHeader header, int version, TypeSizes sizes)
+    public long serializedSize(Row row, SerializationHeader header, int version)
     {
         long size = 1; // flags
 
@@ -243,17 +243,17 @@ public class UnfilteredSerializer
         boolean hasComplexDeletion = row.hasComplexDeletion();
 
         if (!isStatic)
-            size += Clustering.serializer.serializedSize(row.clustering(), version, header.clusteringTypes(), sizes);
+            size += Clustering.serializer.serializedSize(row.clustering(), version, header.clusteringTypes());
 
         if (pkLiveness.hasTimestamp())
-            size += sizes.sizeof(header.encodeTimestamp(pkLiveness.timestamp()));
+            size += TypeSizes.sizeof(header.encodeTimestamp(pkLiveness.timestamp()));
         if (pkLiveness.hasTTL())
         {
-            size += sizes.sizeof(header.encodeTTL(pkLiveness.ttl()));
-            size += sizes.sizeof(header.encodeDeletionTime(pkLiveness.localDeletionTime()));
+            size += TypeSizes.sizeof(header.encodeTTL(pkLiveness.ttl()));
+            size += TypeSizes.sizeof(header.encodeDeletionTime(pkLiveness.localDeletionTime()));
         }
         if (!deletion.isLive())
-            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(deletion, header, sizes);
+            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(deletion, header);
 
         Columns columns = header.columns(isStatic);
         int simpleCount = columns.simpleColumnCount();
@@ -261,18 +261,18 @@ public class UnfilteredSerializer
         SearchIterator<ColumnDefinition, ColumnData> cells = row.searchIterator();
 
         for (int i = 0; i < simpleCount; i++)
-            size += sizeOfSimpleColumn(i, cells.next(columns.getSimple(i)), header, sizes, pkLiveness, useSparse);
+            size += sizeOfSimpleColumn(i, cells.next(columns.getSimple(i)), header, pkLiveness, useSparse);
 
         for (int i = simpleCount; i < columns.columnCount(); i++)
-            size += sizeOfComplexColumn(i, cells.next(columns.getComplex(i - simpleCount)), hasComplexDeletion, header, sizes, pkLiveness, useSparse);
+            size += sizeOfComplexColumn(i, cells.next(columns.getComplex(i - simpleCount)), hasComplexDeletion, header, pkLiveness, useSparse);
 
         if (useSparse)
-            size += sizes.sizeof((short)-1);
+            size += TypeSizes.sizeof((short)-1);
 
         return size;
     }
 
-    private long sizeOfSimpleColumn(int idx, ColumnData data, SerializationHeader header, TypeSizes sizes, LivenessInfo rowLiveness, boolean useSparse)
+    private long sizeOfSimpleColumn(int idx, ColumnData data, SerializationHeader header, LivenessInfo rowLiveness, boolean useSparse)
     {
         long size = 0;
         if (useSparse)
@@ -280,12 +280,12 @@ public class UnfilteredSerializer
             if (data == null)
                 return size;
 
-            size += sizes.sizeof((short)idx);
+            size += TypeSizes.sizeof((short)idx);
         }
-        return size + sizeOfCell(data == null ? null : data.cell(), header, sizes, rowLiveness);
+        return size + sizeOfCell(data == null ? null : data.cell(), header, rowLiveness);
     }
 
-    private long sizeOfComplexColumn(int idx, ColumnData data, boolean hasComplexDeletion, SerializationHeader header, TypeSizes sizes, LivenessInfo rowLiveness, boolean useSparse)
+    private long sizeOfComplexColumn(int idx, ColumnData data, boolean hasComplexDeletion, SerializationHeader header, LivenessInfo rowLiveness, boolean useSparse)
     {
         long size = 0;
         Iterator<Cell> cells = data == null ? null : data.cells();
@@ -296,33 +296,33 @@ public class UnfilteredSerializer
             if (cells == null && deletion.isLive())
                 return size;
 
-            size += sizes.sizeof((short)idx);
+            size += TypeSizes.sizeof((short)idx);
         }
 
         if (hasComplexDeletion)
-            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(deletion, header, sizes);
+            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(deletion, header);
 
         if (cells != null)
             while (cells.hasNext())
-                size += sizeOfCell(cells.next(), header, sizes, rowLiveness);
+                size += sizeOfCell(cells.next(), header, rowLiveness);
 
-        return size + sizeOfCell(null, header, sizes, rowLiveness);
+        return size + sizeOfCell(null, header, rowLiveness);
     }
 
-    public long serializedSize(RangeTombstoneMarker marker, SerializationHeader header, int version, TypeSizes sizes)
+    public long serializedSize(RangeTombstoneMarker marker, SerializationHeader header, int version)
     {
         long size = 1 // flags
-                  + RangeTombstone.Bound.serializer.serializedSize(marker.clustering(), version, header.clusteringTypes(), sizes);
+                  + RangeTombstone.Bound.serializer.serializedSize(marker.clustering(), version, header.clusteringTypes());
 
         if (marker.isBoundary())
         {
             RangeTombstoneBoundaryMarker bm = (RangeTombstoneBoundaryMarker)marker;
-            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(bm.endDeletionTime(), header, sizes);
-            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(bm.startDeletionTime(), header, sizes);
+            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(bm.endDeletionTime(), header);
+            size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(bm.startDeletionTime(), header);
         }
         else
         {
-           size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(((RangeTombstoneBoundMarker)marker).deletionTime(), header, sizes);
+           size += UnfilteredRowIteratorSerializer.delTimeSerializedSize(((RangeTombstoneBoundMarker)marker).deletionTime(), header);
         }
         return size;
     }
@@ -332,7 +332,7 @@ public class UnfilteredSerializer
         out.writeByte((byte)1);
     }
 
-    public long serializedSizeEndOfPartition(TypeSizes sizes)
+    public long serializedSizeEndOfPartition()
     {
         return 1;
     }
@@ -602,7 +602,7 @@ public class UnfilteredSerializer
             cell.column().cellPathSerializer().serialize(cell.path(), out);
     }
 
-    private long sizeOfCell(Cell cell, SerializationHeader header, TypeSizes sizes, LivenessInfo rowLiveness)
+    private long sizeOfCell(Cell cell, SerializationHeader header, LivenessInfo rowLiveness)
     {
         long size = 1; // flags
 
@@ -616,18 +616,18 @@ public class UnfilteredSerializer
         boolean useRowTTL = isExpiring && rowLiveness.hasTTL() && cell.livenessInfo().ttl() == rowLiveness.ttl() && cell.livenessInfo().localDeletionTime() == rowLiveness.localDeletionTime();
 
         if (hasValue)
-            size += header.getType(cell.column()).writtenLength(cell.value(), sizes);
+            size += header.getType(cell.column()).writtenLength(cell.value());
 
         if (!useRowTimestamp)
-            size += sizes.sizeof(header.encodeTimestamp(cell.livenessInfo().timestamp()));
+            size += TypeSizes.sizeof(header.encodeTimestamp(cell.livenessInfo().timestamp()));
 
         if ((isDeleted || isExpiring) && !useRowTTL)
-            size += sizes.sizeof(header.encodeDeletionTime(cell.livenessInfo().localDeletionTime()));
+            size += TypeSizes.sizeof(header.encodeDeletionTime(cell.livenessInfo().localDeletionTime()));
         if (isExpiring && !useRowTTL)
-            size += sizes.sizeof(header.encodeTTL(cell.livenessInfo().ttl()));
+            size += TypeSizes.sizeof(header.encodeTTL(cell.livenessInfo().ttl()));
 
         if (cell.column().isComplex())
-            size += cell.column().cellPathSerializer().serializedSize(cell.path(), sizes);
+            size += cell.column().cellPathSerializer().serializedSize(cell.path());
 
         return size;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/dht/AbstractBounds.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/AbstractBounds.java b/src/java/org/apache/cassandra/dht/AbstractBounds.java
index e295c68..d9a0c62 100644
--- a/src/java/org/apache/cassandra/dht/AbstractBounds.java
+++ b/src/java/org/apache/cassandra/dht/AbstractBounds.java
@@ -163,7 +163,7 @@ public abstract class AbstractBounds<T extends RingPosition<T>> implements Seria
 
         public long serializedSize(AbstractBounds<T> ab, int version)
         {
-            int size = TypeSizes.NATIVE.sizeof(kindInt(ab));
+            int size = TypeSizes.sizeof(kindInt(ab));
             size += serializer.serializedSize(ab.left, version);
             size += serializer.serializedSize(ab.right, version);
             return size;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/dht/BootStrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java
index 42eb6bb..2cb7f61 100644
--- a/src/java/org/apache/cassandra/dht/BootStrapper.java
+++ b/src/java/org/apache/cassandra/dht/BootStrapper.java
@@ -17,16 +17,15 @@
  */
 package org.apache.cassandra.dht;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import com.google.common.util.concurrent.ListenableFuture;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.Keyspace;
@@ -35,6 +34,7 @@ import org.apache.cassandra.dht.tokenallocator.TokenAllocation;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.gms.FailureDetector;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.locator.AbstractReplicationStrategy;
 import org.apache.cassandra.locator.TokenMetadata;
@@ -227,14 +227,14 @@ public class BootStrapper extends ProgressEventNotifierSupport
             out.writeUTF(s);
         }
 
-        public String deserialize(DataInput in, int version) throws IOException
+        public String deserialize(DataInputPlus in, int version) throws IOException
         {
             return in.readUTF();
         }
 
         public long serializedSize(String s, int version)
         {
-            return TypeSizes.NATIVE.sizeof(s);
+            return TypeSizes.sizeof(s);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/dht/Token.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/Token.java b/src/java/org/apache/cassandra/dht/Token.java
index c87b46b..20b45ef 100644
--- a/src/java/org/apache/cassandra/dht/Token.java
+++ b/src/java/org/apache/cassandra/dht/Token.java
@@ -65,7 +65,7 @@ public abstract class Token implements RingPosition<Token>, Serializable
         {
             IPartitioner p = object.getPartitioner();
             ByteBuffer b = p.getTokenFactory().toByteArray(object);
-            return TypeSizes.NATIVE.sizeof(b.remaining()) + b.remaining();
+            return TypeSizes.sizeof(b.remaining()) + b.remaining();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/EchoMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/EchoMessage.java b/src/java/org/apache/cassandra/gms/EchoMessage.java
index 2d4c095..339750d 100644
--- a/src/java/org/apache/cassandra/gms/EchoMessage.java
+++ b/src/java/org/apache/cassandra/gms/EchoMessage.java
@@ -21,10 +21,10 @@ package org.apache.cassandra.gms;
  */
 
 
-import java.io.DataInput;
 import java.io.IOException;
 
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 public final class EchoMessage
@@ -43,7 +43,7 @@ public final class EchoMessage
         {
         }
 
-        public EchoMessage deserialize(DataInput in, int version) throws IOException
+        public EchoMessage deserialize(DataInputPlus in, int version) throws IOException
         {
             return EchoMessage.instance;
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/EndpointState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/EndpointState.java b/src/java/org/apache/cassandra/gms/EndpointState.java
index 0e6985a..d1c023a 100644
--- a/src/java/org/apache/cassandra/gms/EndpointState.java
+++ b/src/java/org/apache/cassandra/gms/EndpointState.java
@@ -22,11 +22,10 @@ import java.util.Map;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
-
 import org.cliffc.high_scale_lib.NonBlockingHashMap;
 
 /**
@@ -156,7 +155,7 @@ class EndpointStateSerializer implements IVersionedSerializer<EndpointState>
         }
     }
 
-    public EndpointState deserialize(DataInput in, int version) throws IOException
+    public EndpointState deserialize(DataInputPlus in, int version) throws IOException
     {
         HeartBeatState hbState = HeartBeatState.serializer.deserialize(in, version);
         EndpointState epState = new EndpointState(hbState);
@@ -174,11 +173,11 @@ class EndpointStateSerializer implements IVersionedSerializer<EndpointState>
     public long serializedSize(EndpointState epState, int version)
     {
         long size = HeartBeatState.serializer.serializedSize(epState.getHeartBeatState(), version);
-        size += TypeSizes.NATIVE.sizeof(epState.applicationState.size());
+        size += TypeSizes.sizeof(epState.applicationState.size());
         for (Map.Entry<ApplicationState, VersionedValue> entry : epState.applicationState.entrySet())
         {
             VersionedValue value = entry.getValue();
-            size += TypeSizes.NATIVE.sizeof(entry.getKey().ordinal());
+            size += TypeSizes.sizeof(entry.getKey().ordinal());
             size += VersionedValue.serializer.serializedSize(value, version);
         }
         return size;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/GossipDigest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigest.java b/src/java/org/apache/cassandra/gms/GossipDigest.java
index 471602e..9dfd486 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigest.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigest.java
@@ -22,6 +22,7 @@ import java.net.InetAddress;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.net.CompactEndpointSerializationHelper;
 
@@ -87,7 +88,7 @@ class GossipDigestSerializer implements IVersionedSerializer<GossipDigest>
         out.writeInt(gDigest.maxVersion);
     }
 
-    public GossipDigest deserialize(DataInput in, int version) throws IOException
+    public GossipDigest deserialize(DataInputPlus in, int version) throws IOException
     {
         InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(in);
         int generation = in.readInt();
@@ -98,8 +99,8 @@ class GossipDigestSerializer implements IVersionedSerializer<GossipDigest>
     public long serializedSize(GossipDigest gDigest, int version)
     {
         long size = CompactEndpointSerializationHelper.serializedSize(gDigest.endpoint);
-        size += TypeSizes.NATIVE.sizeof(gDigest.generation);
-        size += TypeSizes.NATIVE.sizeof(gDigest.maxVersion);
+        size += TypeSizes.sizeof(gDigest.generation);
+        size += TypeSizes.sizeof(gDigest.maxVersion);
         return size;
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/GossipDigestAck.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAck.java b/src/java/org/apache/cassandra/gms/GossipDigestAck.java
index e3be9aa..cf71ae6 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestAck.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestAck.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.gms;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.HashMap;
@@ -26,6 +25,7 @@ import java.util.Map;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.net.CompactEndpointSerializationHelper;
 
@@ -71,7 +71,7 @@ class GossipDigestAckSerializer implements IVersionedSerializer<GossipDigestAck>
         }
     }
 
-    public GossipDigestAck deserialize(DataInput in, int version) throws IOException
+    public GossipDigestAck deserialize(DataInputPlus in, int version) throws IOException
     {
         List<GossipDigest> gDigestList = GossipDigestSerializationHelper.deserialize(in, version);
         int size = in.readInt();
@@ -89,7 +89,7 @@ class GossipDigestAckSerializer implements IVersionedSerializer<GossipDigestAck>
     public long serializedSize(GossipDigestAck ack, int version)
     {
         int size = GossipDigestSerializationHelper.serializedSize(ack.gDigestList, version);
-        size += TypeSizes.NATIVE.sizeof(ack.epStateMap.size());
+        size += TypeSizes.sizeof(ack.epStateMap.size());
         for (Map.Entry<InetAddress, EndpointState> entry : ack.epStateMap.entrySet())
             size += CompactEndpointSerializationHelper.serializedSize(entry.getKey())
                     + EndpointState.serializer.serializedSize(entry.getValue(), version);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/GossipDigestAck2.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAck2.java b/src/java/org/apache/cassandra/gms/GossipDigestAck2.java
index 4a6a06e..9d779fe 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestAck2.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestAck2.java
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.net.CompactEndpointSerializationHelper;
 
@@ -61,7 +62,7 @@ class GossipDigestAck2Serializer implements IVersionedSerializer<GossipDigestAck
         }
     }
 
-    public GossipDigestAck2 deserialize(DataInput in, int version) throws IOException
+    public GossipDigestAck2 deserialize(DataInputPlus in, int version) throws IOException
     {
         int size = in.readInt();
         Map<InetAddress, EndpointState> epStateMap = new HashMap<InetAddress, EndpointState>(size);
@@ -77,7 +78,7 @@ class GossipDigestAck2Serializer implements IVersionedSerializer<GossipDigestAck
 
     public long serializedSize(GossipDigestAck2 ack2, int version)
     {
-        long size = TypeSizes.NATIVE.sizeof(ack2.epStateMap.size());
+        long size = TypeSizes.sizeof(ack2.epStateMap.size());
         for (Map.Entry<InetAddress, EndpointState> entry : ack2.epStateMap.entrySet())
             size += CompactEndpointSerializationHelper.serializedSize(entry.getKey())
                     + EndpointState.serializer.serializedSize(entry.getValue(), version);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/GossipDigestSyn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestSyn.java b/src/java/org/apache/cassandra/gms/GossipDigestSyn.java
index 0ad67bd..17c8da3 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestSyn.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestSyn.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 /**
@@ -59,7 +60,7 @@ class GossipDigestSerializationHelper
             GossipDigest.serializer.serialize(gDigest, out, version);
     }
 
-    static List<GossipDigest> deserialize(DataInput in, int version) throws IOException
+    static List<GossipDigest> deserialize(DataInputPlus in, int version) throws IOException
     {
         int size = in.readInt();
         List<GossipDigest> gDigests = new ArrayList<GossipDigest>(size);
@@ -70,7 +71,7 @@ class GossipDigestSerializationHelper
 
     static int serializedSize(List<GossipDigest> digests, int version)
     {
-        int size = TypeSizes.NATIVE.sizeof(digests.size());
+        int size = TypeSizes.sizeof(digests.size());
         for (GossipDigest digest : digests)
             size += GossipDigest.serializer.serializedSize(digest, version);
         return size;
@@ -86,7 +87,7 @@ class GossipDigestSynSerializer implements IVersionedSerializer<GossipDigestSyn>
         GossipDigestSerializationHelper.serialize(gDigestSynMessage.gDigests, out, version);
     }
 
-    public GossipDigestSyn deserialize(DataInput in, int version) throws IOException
+    public GossipDigestSyn deserialize(DataInputPlus in, int version) throws IOException
     {
         String clusterId = in.readUTF();
         String partioner = null;
@@ -97,8 +98,8 @@ class GossipDigestSynSerializer implements IVersionedSerializer<GossipDigestSyn>
 
     public long serializedSize(GossipDigestSyn syn, int version)
     {
-        long size = TypeSizes.NATIVE.sizeof(syn.clusterId);
-        size += TypeSizes.NATIVE.sizeof(syn.partioner);
+        long size = TypeSizes.sizeof(syn.clusterId);
+        size += TypeSizes.sizeof(syn.partioner);
         size += GossipDigestSerializationHelper.serializedSize(syn.gDigests, version);
         return size;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/HeartBeatState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/HeartBeatState.java b/src/java/org/apache/cassandra/gms/HeartBeatState.java
index 0ae48bf..1794c1a 100644
--- a/src/java/org/apache/cassandra/gms/HeartBeatState.java
+++ b/src/java/org/apache/cassandra/gms/HeartBeatState.java
@@ -21,6 +21,7 @@ import java.io.*;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 /**
@@ -83,13 +84,13 @@ class HeartBeatStateSerializer implements IVersionedSerializer<HeartBeatState>
         out.writeInt(hbState.getHeartBeatVersion());
     }
 
-    public HeartBeatState deserialize(DataInput in, int version) throws IOException
+    public HeartBeatState deserialize(DataInputPlus in, int version) throws IOException
     {
         return new HeartBeatState(in.readInt(), in.readInt());
     }
 
     public long serializedSize(HeartBeatState state, int version)
     {
-        return TypeSizes.NATIVE.sizeof(state.getGeneration()) + TypeSizes.NATIVE.sizeof(state.getHeartBeatVersion());
+        return TypeSizes.sizeof(state.getGeneration()) + TypeSizes.sizeof(state.getHeartBeatVersion());
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/gms/VersionedValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/VersionedValue.java b/src/java/org/apache/cassandra/gms/VersionedValue.java
index a142f41..25f7706 100644
--- a/src/java/org/apache/cassandra/gms/VersionedValue.java
+++ b/src/java/org/apache/cassandra/gms/VersionedValue.java
@@ -18,7 +18,6 @@
 package org.apache.cassandra.gms;
 
 import java.io.*;
-
 import java.net.InetAddress;
 import java.util.Collection;
 import java.util.UUID;
@@ -31,10 +30,10 @@ import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.utils.FBUtilities;
-
 import org.apache.commons.lang3.StringUtils;
 
 
@@ -272,7 +271,7 @@ public class VersionedValue implements Comparable<VersionedValue>
             return value.value;
         }
 
-        public VersionedValue deserialize(DataInput in, int version) throws IOException
+        public VersionedValue deserialize(DataInputPlus in, int version) throws IOException
         {
             String value = in.readUTF();
             int valVersion = in.readInt();
@@ -281,7 +280,7 @@ public class VersionedValue implements Comparable<VersionedValue>
 
         public long serializedSize(VersionedValue value, int version)
         {
-            return TypeSizes.NATIVE.sizeof(outValue(value, version)) + TypeSizes.NATIVE.sizeof(value.version);
+            return TypeSizes.sizeof(outValue(value, version)) + TypeSizes.sizeof(value.version);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/ISerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/ISerializer.java b/src/java/org/apache/cassandra/io/ISerializer.java
index 7e1759c..562d226 100644
--- a/src/java/org/apache/cassandra/io/ISerializer.java
+++ b/src/java/org/apache/cassandra/io/ISerializer.java
@@ -17,10 +17,9 @@
  */
 package org.apache.cassandra.io;
 
-import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.cassandra.db.TypeSizes;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 public interface ISerializer<T>
@@ -41,7 +40,7 @@ public interface ISerializer<T>
      * @throws IOException
      * @return the type that was deserialized
      */
-    public T deserialize(DataInput in) throws IOException;
+    public T deserialize(DataInputPlus in) throws IOException;
 
-    public long serializedSize(T t, TypeSizes type);
+    public long serializedSize(T t);
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/IVersionedSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/IVersionedSerializer.java b/src/java/org/apache/cassandra/io/IVersionedSerializer.java
index 2572840..e555573 100644
--- a/src/java/org/apache/cassandra/io/IVersionedSerializer.java
+++ b/src/java/org/apache/cassandra/io/IVersionedSerializer.java
@@ -17,9 +17,9 @@
  */
 package org.apache.cassandra.io;
 
-import java.io.DataInput;
 import java.io.IOException;
 
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 public interface IVersionedSerializer<T>
@@ -41,7 +41,7 @@ public interface IVersionedSerializer<T>
      * @return the type that was deserialized
      * @throws IOException if deserialization fails
      */
-    public T deserialize(DataInput in, int version) throws IOException;
+    public T deserialize(DataInputPlus in, int version) throws IOException;
 
     /**
      * Calculate serialized size of object without actually serializing.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
index 23a9f3e..070be9f 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
@@ -47,6 +47,7 @@ import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.sstable.Component;
 import org.apache.cassandra.io.sstable.CorruptSSTableException;
 import org.apache.cassandra.io.sstable.Descriptor;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.io.util.Memory;
@@ -462,15 +463,15 @@ public class CompressionMetadata
             out.writeInt(chunk.length);
         }
 
-        public Chunk deserialize(DataInput in, int version) throws IOException
+        public Chunk deserialize(DataInputPlus in, int version) throws IOException
         {
             return new Chunk(in.readLong(), in.readInt());
         }
 
         public long serializedSize(Chunk chunk, int version)
         {
-            long size = TypeSizes.NATIVE.sizeof(chunk.offset);
-            size += TypeSizes.NATIVE.sizeof(chunk.length);
+            long size = TypeSizes.sizeof(chunk.offset);
+            size += TypeSizes.sizeof(chunk.length);
             return size;
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
index b114826..264d523 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.io.compress;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -37,6 +36,7 @@ import org.apache.cassandra.config.ParameterizedClass;
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 public class CompressionParameters
@@ -338,7 +338,7 @@ public class CompressionParameters
             out.writeInt(parameters.chunkLength());
         }
 
-        public CompressionParameters deserialize(DataInput in, int version) throws IOException
+        public CompressionParameters deserialize(DataInputPlus in, int version) throws IOException
         {
             String compressorName = in.readUTF();
             int optionCount = in.readInt();
@@ -364,14 +364,14 @@ public class CompressionParameters
 
         public long serializedSize(CompressionParameters parameters, int version)
         {
-            long size = TypeSizes.NATIVE.sizeof(parameters.sstableCompressor.getClass().getSimpleName());
-            size += TypeSizes.NATIVE.sizeof(parameters.otherOptions.size());
+            long size = TypeSizes.sizeof(parameters.sstableCompressor.getClass().getSimpleName());
+            size += TypeSizes.sizeof(parameters.otherOptions.size());
             for (Map.Entry<String, String> entry : parameters.otherOptions.entrySet())
             {
-                size += TypeSizes.NATIVE.sizeof(entry.getKey());
-                size += TypeSizes.NATIVE.sizeof(entry.getValue());
+                size += TypeSizes.sizeof(entry.getKey());
+                size += TypeSizes.sizeof(entry.getValue());
             }
-            size += TypeSizes.NATIVE.sizeof(parameters.chunkLength());
+            size += TypeSizes.sizeof(parameters.chunkLength());
             return size;
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/IndexHelper.java b/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
index d19c8f7..b57724a 100644
--- a/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
+++ b/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
@@ -26,6 +26,7 @@ import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.io.ISerializer;
 import org.apache.cassandra.io.sstable.format.Version;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.io.util.FileUtils;
@@ -165,7 +166,7 @@ public class IndexHelper
                 }
             }
 
-            public IndexInfo deserialize(DataInput in, SerializationHeader header) throws IOException
+            public IndexInfo deserialize(DataInputPlus in, SerializationHeader header) throws IOException
             {
                 ISerializer<ClusteringPrefix> clusteringSerializer = metadata.serializers().clusteringPrefixSerializer(version, header);
 
@@ -180,19 +181,19 @@ public class IndexHelper
                 return new IndexInfo(firstName, lastName, offset, width, endOpenMarker);
             }
 
-            public long serializedSize(IndexInfo info, SerializationHeader header, TypeSizes typeSizes)
+            public long serializedSize(IndexInfo info, SerializationHeader header)
             {
                 ISerializer<ClusteringPrefix> clusteringSerializer = metadata.serializers().clusteringPrefixSerializer(version, header);
-                long size = clusteringSerializer.serializedSize(info.firstName, typeSizes)
-                          + clusteringSerializer.serializedSize(info.lastName, typeSizes)
-                          + typeSizes.sizeof(info.offset)
-                          + typeSizes.sizeof(info.width);
+                long size = clusteringSerializer.serializedSize(info.firstName)
+                          + clusteringSerializer.serializedSize(info.lastName)
+                          + TypeSizes.sizeof(info.offset)
+                          + TypeSizes.sizeof(info.width);
 
                 if (version.storeRows())
                 {
-                    size += typeSizes.sizeof(info.endOpenMarker != null);
+                    size += TypeSizes.sizeof(info.endOpenMarker != null);
                     if (info.endOpenMarker != null)
-                        size += DeletionTime.serializer.serializedSize(info.endOpenMarker, typeSizes);
+                        size += DeletionTime.serializer.serializedSize(info.endOpenMarker);
                 }
                 return size;
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/SSTableSimpleIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleIterator.java b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleIterator.java
index 1188de1..9e2faee 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleIterator.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleIterator.java
@@ -28,6 +28,7 @@ import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.rows.*;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.io.util.FileMark;
 import org.apache.cassandra.net.MessagingService;
@@ -51,7 +52,7 @@ public abstract class SSTableSimpleIterator extends AbstractIterator<Unfiltered>
         this.helper = helper;
     }
 
-    public static SSTableSimpleIterator create(CFMetaData metadata, DataInput in, SerializationHeader header, SerializationHelper helper, DeletionTime partitionDeletion)
+    public static SSTableSimpleIterator create(CFMetaData metadata, DataInputPlus in, SerializationHeader header, SerializationHelper helper, DeletionTime partitionDeletion)
     {
         if (helper.version < MessagingService.VERSION_30)
             return new OldFormatIterator(metadata, in, helper, partitionDeletion);
@@ -108,7 +109,7 @@ public abstract class SSTableSimpleIterator extends AbstractIterator<Unfiltered>
     {
         private final UnfilteredDeserializer deserializer;
 
-        private OldFormatIterator(CFMetaData metadata, DataInput in, SerializationHelper helper, DeletionTime partitionDeletion)
+        private OldFormatIterator(CFMetaData metadata, DataInputPlus in, SerializationHelper helper, DeletionTime partitionDeletion)
         {
             super(metadata, in, helper);
             // We use an UnfilteredDeserializer because even though we don't need all it's fanciness, it happens to handle all

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
index a226585..5dbe52a 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@ -76,7 +76,7 @@ class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
         if (previous == null)
         {
             previous = createPartitionUpdate(key);
-            count(PartitionUpdate.serializer.serializedSize(previous, formatType.info.getLatestVersion().correspondingMessagingVersion(), TypeSizes.NATIVE));
+            count(PartitionUpdate.serializer.serializedSize(previous, formatType.info.getLatestVersion().correspondingMessagingVersion()));
             previous.allowNewUpdates();
             buffer.put(key, previous);
         }
@@ -99,7 +99,7 @@ class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
         count(1); // Each cell has a byte flag on disk
 
         if (value.hasRemaining())
-            count(column.type.writtenLength(value, TypeSizes.NATIVE));
+            count(column.type.writtenLength(value));
 
         count(8); // timestamp
         if (info.hasLocalDeletionTime())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/metadata/CompactionMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/metadata/CompactionMetadata.java b/src/java/org/apache/cassandra/io/sstable/metadata/CompactionMetadata.java
index ed1f327..29cbe5b 100644
--- a/src/java/org/apache/cassandra/io/sstable/metadata/CompactionMetadata.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/CompactionMetadata.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.io.sstable.metadata;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
@@ -27,6 +26,7 @@ import com.clearspring.analytics.stream.cardinality.ICardinality;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.sstable.format.Version;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
@@ -75,11 +75,11 @@ public class CompactionMetadata extends MetadataComponent
         public int serializedSize(CompactionMetadata component) throws IOException
         {
             int size = 0;
-            size += TypeSizes.NATIVE.sizeof(component.ancestors.size());
+            size += TypeSizes.sizeof(component.ancestors.size());
             for (int g : component.ancestors)
-                size += TypeSizes.NATIVE.sizeof(g);
+                size += TypeSizes.sizeof(g);
             byte[] serializedCardinality = component.cardinalityEstimator.getBytes();
-            size += TypeSizes.NATIVE.sizeof(serializedCardinality.length) + serializedCardinality.length;
+            size += TypeSizes.sizeof(serializedCardinality.length) + serializedCardinality.length;
             return size;
         }
 
@@ -91,7 +91,7 @@ public class CompactionMetadata extends MetadataComponent
             ByteBufferUtil.writeWithLength(component.cardinalityEstimator.getBytes(), out);
         }
 
-        public CompactionMetadata deserialize(Version version, DataInput in) throws IOException
+        public CompactionMetadata deserialize(Version version, DataInputPlus in) throws IOException
         {
             int nbAncestors = in.readInt();
             Set<Integer> ancestors = new HashSet<>(nbAncestors);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java b/src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java
index dc8fbdf..046e290 100644
--- a/src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java
@@ -17,10 +17,10 @@
  */
 package org.apache.cassandra.io.sstable.metadata;
 
-import java.io.DataInput;
 import java.io.IOException;
 
 import org.apache.cassandra.io.sstable.format.Version;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 /**
@@ -55,5 +55,5 @@ public interface IMetadataComponentSerializer<T extends MetadataComponent>
      * @return Deserialized component
      * @throws IOException
      */
-    T deserialize(Version version, DataInput in) throws IOException;
+    T deserialize(Version version, DataInputPlus in) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/metadata/LegacyMetadataSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/metadata/LegacyMetadataSerializer.java b/src/java/org/apache/cassandra/io/sstable/metadata/LegacyMetadataSerializer.java
index 90a9f24..ab048d6 100644
--- a/src/java/org/apache/cassandra/io/sstable/metadata/LegacyMetadataSerializer.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/LegacyMetadataSerializer.java
@@ -23,10 +23,10 @@ import java.util.*;
 
 import com.google.common.collect.Maps;
 
-import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.commitlog.ReplayPosition;
 import org.apache.cassandra.io.sstable.Component;
 import org.apache.cassandra.io.sstable.Descriptor;
+import org.apache.cassandra.io.util.DataInputPlus.DataInputStreamPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.service.ActiveRepairService;
 import org.apache.cassandra.utils.ByteBufferUtil;
@@ -88,7 +88,7 @@ public class LegacyMetadataSerializer extends MetadataSerializer
         }
         else
         {
-            try (DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(statsFile))))
+            try (DataInputStreamPlus in = new DataInputStreamPlus(new BufferedInputStream(new FileInputStream(statsFile))))
             {
                 EstimatedHistogram rowSizes = EstimatedHistogram.serializer.deserialize(in);
                 EstimatedHistogram columnCounts = EstimatedHistogram.serializer.deserialize(in);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java b/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
index 809d6b3..e5ec3fd 100644
--- a/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.io.sstable.metadata;
 
-import java.io.DataInput;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -26,9 +25,9 @@ import java.util.List;
 import org.apache.cassandra.io.sstable.format.Version;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.db.commitlog.ReplayPosition;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.EstimatedHistogram;
@@ -231,12 +230,12 @@ public class StatsMetadata extends MetadataComponent
         public int serializedSize(StatsMetadata component) throws IOException
         {
             int size = 0;
-            size += EstimatedHistogram.serializer.serializedSize(component.estimatedRowSize, TypeSizes.NATIVE);
-            size += EstimatedHistogram.serializer.serializedSize(component.estimatedColumnCount, TypeSizes.NATIVE);
-            size += ReplayPosition.serializer.serializedSize(component.replayPosition, TypeSizes.NATIVE);
+            size += EstimatedHistogram.serializer.serializedSize(component.estimatedRowSize);
+            size += EstimatedHistogram.serializer.serializedSize(component.estimatedColumnCount);
+            size += ReplayPosition.serializer.serializedSize(component.replayPosition);
             size += 8 + 8 + 4 + 4 + 4 + 4 + 8 + 8; // mix/max timestamp(long), min/maxLocalDeletionTime(int), min/max TTL, compressionRatio(double), repairedAt (long)
-            size += StreamingHistogram.serializer.serializedSize(component.estimatedTombstoneDropTime, TypeSizes.NATIVE);
-            size += TypeSizes.NATIVE.sizeof(component.sstableLevel);
+            size += StreamingHistogram.serializer.serializedSize(component.estimatedTombstoneDropTime);
+            size += TypeSizes.sizeof(component.sstableLevel);
             // min column names
             size += 4;
             for (ByteBuffer value : component.minClusteringValues)
@@ -245,7 +244,7 @@ public class StatsMetadata extends MetadataComponent
             size += 4;
             for (ByteBuffer value : component.maxClusteringValues)
                 size += 2 + value.remaining(); // with short length
-            size += TypeSizes.NATIVE.sizeof(component.hasLegacyCounterShards);
+            size += TypeSizes.sizeof(component.hasLegacyCounterShards);
             size += 8 + 8; // totalColumnsSet, totalRows
             return size;
         }
@@ -277,7 +276,7 @@ public class StatsMetadata extends MetadataComponent
             out.writeLong(component.totalRows);
         }
 
-        public StatsMetadata deserialize(Version version, DataInput in) throws IOException
+        public StatsMetadata deserialize(Version version, DataInputPlus in) throws IOException
         {
             EstimatedHistogram rowSizes = EstimatedHistogram.serializer.deserialize(in);
             EstimatedHistogram columnCounts = EstimatedHistogram.serializer.deserialize(in);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/sstable/metadata/ValidationMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/metadata/ValidationMetadata.java b/src/java/org/apache/cassandra/io/sstable/metadata/ValidationMetadata.java
index 603732b..72bfdcb 100644
--- a/src/java/org/apache/cassandra/io/sstable/metadata/ValidationMetadata.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/ValidationMetadata.java
@@ -17,11 +17,11 @@
  */
 package org.apache.cassandra.io.sstable.metadata;
 
-import java.io.DataInput;
 import java.io.IOException;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.sstable.format.Version;
+import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
 /**
@@ -73,7 +73,7 @@ public class ValidationMetadata extends MetadataComponent
     {
         public int serializedSize(ValidationMetadata component) throws IOException
         {
-            return TypeSizes.NATIVE.sizeof(component.partitioner) + 8;
+            return TypeSizes.sizeof(component.partitioner) + 8;
         }
 
         public void serialize(ValidationMetadata component, DataOutputPlus out) throws IOException
@@ -82,7 +82,7 @@ public class ValidationMetadata extends MetadataComponent
             out.writeDouble(component.bloomFilterFPChance);
         }
 
-        public ValidationMetadata deserialize(Version version, DataInput in) throws IOException
+        public ValidationMetadata deserialize(Version version, DataInputPlus in) throws IOException
         {
 
             return new ValidationMetadata(in.readUTF(), in.readDouble());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/03f72acd/src/java/org/apache/cassandra/io/util/AbstractDataInput.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/AbstractDataInput.java b/src/java/org/apache/cassandra/io/util/AbstractDataInput.java
index 935a06d..29ce2c3 100644
--- a/src/java/org/apache/cassandra/io/util/AbstractDataInput.java
+++ b/src/java/org/apache/cassandra/io/util/AbstractDataInput.java
@@ -19,9 +19,7 @@ package org.apache.cassandra.io.util;
 
 import java.io.*;
 
-import org.apache.cassandra.utils.vint.VIntCoding;
-
-public abstract class AbstractDataInput extends InputStream implements DataInput
+public abstract class AbstractDataInput extends InputStream implements DataInputPlus
 {
     public abstract void seek(long position) throws IOException;
     public abstract long getPosition();
@@ -267,38 +265,6 @@ public abstract class AbstractDataInput extends InputStream implements DataInput
     }
 
     /**
-     * Reads a varint encoded integer from the current position in this file. Blocks until
-     * the end of the varint is reached, the end of the file is reached, or an exception is
-     * thrown.
-     *
-     * @return the next varint value from this file.
-     * @throws EOFException
-     *             if the end of this file is detected.
-     * @throws IOException
-     *             if this file is closed or another I/O error occurs.
-     */
-    public long readVInt() throws IOException
-    {
-        return VIntCoding.readVInt(this);
-    }
-
-    /**
-     * Reads an unsigned varint encoded integer from the current position in this file. Blocks until
-     * the end of the varint is reached, the end of the file is reached, or an exception is
-     * thrown.
-     *
-     * @return the next unsigned varint value from this file.
-     * @throws EOFException
-     *             if the end of this file is detected.
-     * @throws IOException
-     *             if this file is closed or another I/O error occurs.
-     */
-    public long readUnsignedVInt() throws IOException
-    {
-        return VIntCoding.readUnsignedVInt(this);
-    }
-
-    /**
      * Reads a 16-bit short from the current position in this file. Blocks until
      * two bytes have been read, the end of the file is reached or an exception
      * is thrown.


Mime
View raw message