Java Code Examples for org.apache.cassandra.utils.ByteBufferUtil#hexToBytes()
The following examples show how to use
org.apache.cassandra.utils.ByteBufferUtil#hexToBytes() .
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: Segment.java From emodb with Apache License 2.0 | 6 votes |
/** Loads a segment from a persistent snapshot. */ Segment(UUID id, Snapshot snapshot, long splitThresholdBytes, SplitQueue<Segment> splitQueue) { // Fail if the segment was written with a newer incompatible data format. if (snapshot.version > PERSISTENCE_VERSION) { throw new UnsupportedOperationException("Unsupported persistent sorted queue data version: " + snapshot.version); } _id = checkNotNull(id, "id"); _dataId = Objects.firstNonNull(snapshot.dataId, id); // dataId should be non-null except for segments before dataId was introduced _min = (snapshot.min != null) ? ByteBufferUtil.hexToBytes(snapshot.min) : null; _adds = snapshot.adds; _bytesAdded = snapshot.bytesAdded; try { _distinctAdds = HyperLogLog.Builder.build(checkNotNull(snapshot.distinctAddsHll, "distinctAddsHll")); } catch (IOException e) { throw Throwables.propagate(e); } _deletes = snapshot.deletes; _bytesUntilSplitCheckSize = snapshot.bytesUntilSplitCheckSize; _bytesUntilSplitCheckRemaining = 0; _splitThresholdBytes = splitThresholdBytes; _splitting = snapshot.splitting; _splitTargetSize = snapshot.splitTargetSize; _splitTargetRemaining = snapshot.splitTargetRemaining; _splitQueue = checkNotNull(splitQueue, "splitQueue"); }
Example 2
Source File: ScanUploaderTest.java From emodb with Apache License 2.0 | 5 votes |
private ScanRangeSplits.SplitGroup createSimpleSplitGroup(String startToken, String endToken) { ByteBuffer startTokenBytes = ByteBufferUtil.hexToBytes(startToken); ByteBuffer endTokenBytes = ByteBufferUtil.hexToBytes(endToken); return new ScanRangeSplits.SplitGroup(ImmutableList.of( new ScanRangeSplits.TokenRange(ImmutableList.of( ScanRange.create(startTokenBytes, endTokenBytes))))); }
Example 3
Source File: TypeParser.java From stratio-cassandra with Apache License 2.0 | 5 votes |
private ByteBuffer fromHex(String hex) throws SyntaxException { try { return ByteBufferUtil.hexToBytes(hex); } catch (NumberFormatException e) { throwSyntaxError(e.getMessage()); return null; } }
Example 4
Source File: ColumnToCollectionType.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ByteBuffer fromString(String source) { try { return ByteBufferUtil.hexToBytes(source); } catch (NumberFormatException e) { throw new MarshalException(String.format("cannot parse '%s' as hex bytes", source), e); } }
Example 5
Source File: CollectionType.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ByteBuffer fromString(String source) { try { return ByteBufferUtil.hexToBytes(source); } catch (NumberFormatException e) { throw new MarshalException(String.format("cannot parse '%s' as hex bytes", source), e); } }
Example 6
Source File: ColumnMapperBlobTest.java From stratio-cassandra with Apache License 2.0 | 5 votes |
@Test public void testValueByteBuffer() { ColumnMapperBlob mapper = new ColumnMapperBlob(); ByteBuffer bb = ByteBufferUtil.hexToBytes("f1"); String parsed = mapper.indexValue("test", bb); Assert.assertEquals("f1", parsed); }
Example 7
Source File: CounterColumnType.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public ByteBuffer fromString(String source) { return ByteBufferUtil.hexToBytes(source); }