Java Code Examples for org.apache.cassandra.utils.ByteBufferUtil#inputStream()
The following examples show how to use
org.apache.cassandra.utils.ByteBufferUtil#inputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PagingState.java From stratio-cassandra with Apache License 2.0 | 6 votes |
public static PagingState deserialize(ByteBuffer bytes) { if (bytes == null) return null; try { DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bytes)); ByteBuffer pk = ByteBufferUtil.readWithShortLength(in); ByteBuffer cn = ByteBufferUtil.readWithShortLength(in); int remaining = in.readInt(); return new PagingState(pk, cn, remaining); } catch (IOException e) { throw new ProtocolException("Invalid value for the paging state"); } }
Example 2
Source File: BatchlogManager.java From stratio-cassandra with Apache License 2.0 | 6 votes |
private List<Mutation> replayingMutations() throws IOException { DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(data)); int size = in.readInt(); List<Mutation> mutations = new ArrayList<>(size); for (int i = 0; i < size; i++) { Mutation mutation = Mutation.serializer.deserialize(in, version); // Remove CFs that have been truncated since. writtenAt and SystemTable#getTruncatedAt() both return millis. // We don't abort the replay entirely b/c this can be considered a success (truncated is same as delivered then // truncated. for (UUID cfId : mutation.getColumnFamilyIds()) if (writtenAt <= SystemKeyspace.getTruncatedAt(cfId)) mutation = mutation.without(cfId); if (!mutation.isEmpty()) mutations.add(mutation); } return mutations; }