Java Code Examples for com.google.protobuf.ByteString.ByteIterator
The following examples show how to use
com.google.protobuf.ByteString.ByteIterator. These examples are extracted from open source projects.
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 Project: heroic Source File: BigtableBackendTest.java License: Apache License 2.0 | 6 votes |
int compare(ByteString a, ByteString b) { ByteIterator itA = a.iterator(); ByteIterator itB = b.iterator(); while (itA.hasNext()) { if (!itB.hasNext()) { return -1; } int bA = itA.nextByte() & 0xff; int bB = itB.nextByte() & 0xff; int c = Integer.compare(bA, bB); if (c != 0) { return c; } } if (itB.hasNext()) { return 1; } return 0; }
Example 2
Source Project: jaeger-analytics-java Source File: ProtoSpanDeserializer.java License: Apache License 2.0 | 5 votes |
private String asHexString(ByteString id) { ByteIterator iterator = id.iterator(); StringBuilder out = new StringBuilder(); while (iterator.hasNext()) { byte b = iterator.nextByte(); out.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F))); } return out.toString(); }
Example 3
Source Project: Mastering-Distributed-Tracing Source File: ProtoUnmarshaler.java License: MIT License | 5 votes |
private String asHexString(ByteString id) { ByteIterator iterator = id.iterator(); StringBuilder out = new StringBuilder(); while (iterator.hasNext()) { byte b = iterator.nextByte(); out.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F))); } return out.toString(); }