Home
last modified time | relevance | path

Searched refs:ByteString (Results 1 – 25 of 226) sorted by relevance

12345678910

/third_party/protobuf/java/core/src/test/java/com/google/protobuf/
DByteStringTest.java33 import com.google.protobuf.ByteString.Output;
92 ByteString string1 = ByteString.copyFrom(referenceBytes); in testCompare_equalByteStrings_compareEqual()
93 ByteString string2 = ByteString.copyFrom(referenceBytes); in testCompare_equalByteStrings_compareEqual()
98 ByteString.unsignedLexicographicalComparator().compare(string1, string2)); in testCompare_equalByteStrings_compareEqual()
102 ByteString app = ByteString.copyFromUtf8("app"); in testCompare_byteStringsSortLexicographically()
103 ByteString apple = ByteString.copyFromUtf8("apple"); in testCompare_byteStringsSortLexicographically()
104 ByteString banana = ByteString.copyFromUtf8("banana"); in testCompare_byteStringsSortLexicographically()
106 Comparator<ByteString> comparator = ByteString.unsignedLexicographicalComparator(); in testCompare_byteStringsSortLexicographically()
115 ByteString twoHundredFiftyFive = ByteString.copyFrom(new byte[] {-1}); in testCompare_interpretsByteValuesAsUnsigned()
117 ByteString one = ByteString.copyFrom(new byte[] {1}); in testCompare_interpretsByteValuesAsUnsigned()
[all …]
DRopeByteStringTest.java57 Iterator<ByteString> iter = ByteStringTest.makeConcretePieces(referenceBytes).iterator(); in setUp()
93 ByteString concatenated = ByteString.EMPTY; in testBalance()
95 concatenated = concatenated.concat(ByteString.copyFrom(testBytes, i * pieceSize, pieceSize)); in testBalance()
105 ByteString testString = ByteString.copyFrom(testBytes); in testBalance()
119 ByteString sourceByteString = ByteString.copyFromUtf8(sourceString); in testToString()
124 ByteString unicode = ByteString.EMPTY; in testToString()
137 ByteString flatString = ByteString.copyFromUtf8(testString); in testToString()
148 ByteString sourceByteString = ByteString.copyFromUtf8(sourceString); in testCharsetToString()
153 ByteString unicode = ByteString.EMPTY; in testCharsetToString()
166 ByteString flatString = ByteString.copyFromUtf8(testString); in testCharsetToString()
[all …]
DRopeByteStringSubstringTest.java48 Iterator<ByteString> iter = ByteStringTest.makeConcretePieces(sourceBytes).iterator(); in setUp()
49 ByteString sourceString = iter.next(); in setUp()
71 ByteString sourceByteString = ByteString.copyFromUtf8(sourceString); in testToString()
76 ByteString unicode = ByteString.EMPTY; in testToString()
93 ByteString flatString = ByteString.copyFromUtf8(testString); in testToString()
104 ByteString sourceByteString = ByteString.copyFromUtf8(sourceString); in testCharsetToString()
109 ByteString unicode = ByteString.EMPTY; in testCharsetToString()
126 ByteString flatString = ByteString.copyFromUtf8(testString); in testCharsetToString()
DUnmodifiableLazyStringListTest.java49 private static final ByteString BYTE_STRING_A = ByteString.copyFromUtf8("A");
50 private static final ByteString BYTE_STRING_B = ByteString.copyFromUtf8("B");
51 private static final ByteString BYTE_STRING_C = ByteString.copyFromUtf8("C");
64 List<ByteString> byteStringList = list.asByteStringList(); in testReadOnlyMethods()
98 List<ByteString> byteStringList = list.asByteStringList(); in testModifyMethods()
145 List<ByteString> byteStringList = list.asByteStringList(); in testIterator()
146 Iterator<ByteString> byteIter = byteStringList.iterator(); in testIterator()
191 List<ByteString> byteStringList = list.asByteStringList(); in testListIterator()
192 ListIterator<ByteString> byteIter = byteStringList.listIterator(); in testListIterator()
DIsValidUtf8Test.java135 ByteString leaf = factory.newByteString(realBytes); in assertValidUtf8()
136 ByteString sub = leaf.substring(0, bytes.length); in assertValidUtf8()
139 ByteString[] ropes = { in assertValidUtf8()
140 RopeByteString.newInstanceForTest(ByteString.EMPTY, leaf), in assertValidUtf8()
141 RopeByteString.newInstanceForTest(ByteString.EMPTY, sub), in assertValidUtf8()
142 RopeByteString.newInstanceForTest(leaf, ByteString.EMPTY), in assertValidUtf8()
143 RopeByteString.newInstanceForTest(sub, ByteString.EMPTY), in assertValidUtf8()
146 for (ByteString rope : ropes) { in assertValidUtf8()
163 private static ByteString asBytes(String s) { in asBytes()
164 return ByteString.copyFromUtf8(s); in asBytes()
DNioByteStringTest.java53 private static final ByteString EMPTY = new NioByteString(ByteBuffer.wrap(new byte[0]));
56 private static final int EXPECTED_HASH = ByteString.wrap(BYTES).hashCode();
59 private final ByteString testString = new NioByteString(backingBuffer);
82 ByteString.ByteIterator iter = testString.iterator(); in testByteIterator()
413 ByteString.Output output = ByteString.newOutput(); in testNewOutput()
434 ByteString unicode = forString(testString); in testToString()
441 ByteString unicode = forString(testString); in testCharsetToString()
486 ByteString literal = ByteString.copyFrom(BYTES); in testEqualsLiteralByteString()
490 CLASSNAME + " must not equal the empty string", testString.equals(ByteString.EMPTY)); in testEqualsLiteralByteString()
492 CLASSNAME + " empty strings must be equal", ByteString.EMPTY, testString.substring(55, 55)); in testEqualsLiteralByteString()
[all …]
DBoundedByteStringTest.java55 stringUnderTest = ByteString.copyFrom(sourceBytes).substring(from, to); in setUp()
64 ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); in testToString()
65 ByteString chopped = unicode.substring(2, unicode.size() - 6); in testToString()
81 ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); in testCharsetToString()
82 ByteString chopped = unicode.substring(2, unicode.size() - 6); in testCharsetToString()
105 assertTrue("Didn't get a ByteString back", o instanceof ByteString); in testJavaSerialization()
DLazyStringEndToEndTest.java44 private static final ByteString TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8 =
45 ByteString.copyFrom(
51 private ByteString encodedTestAllTypes;
69 ByteString bytes = tV2.toByteString(); in testParseAndSerialize()
84 assertEquals(TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8, ByteString.copyFrom(sink)); in testParseAndWrite()
114 ByteString optional = proto.getOptionalStringBytes(); in testNoStringCachingIfOnlyBytesAccessed()
118 ByteString repeated0 = proto.getRepeatedStringBytes(0); in testNoStringCachingIfOnlyBytesAccessed()
119 ByteString repeated1 = proto.getRepeatedStringBytes(1); in testNoStringCachingIfOnlyBytesAccessed()
DLiteralByteStringTest.java62 protected ByteString stringUnderTest;
69 stringUnderTest = ByteString.copyFrom(referenceBytes); in setUp()
92 ByteString.ByteIterator iter = stringUnderTest.iterator(); in testByteIterator()
398 ByteString.Output output = ByteString.newOutput(); in testNewOutput()
415 assertEquals("Output.reset() resets the output", ByteString.EMPTY, output.toByteString()); in testNewOutput()
420 ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); in testToString()
427 ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); in testCharsetToString()
435 ByteString.EMPTY.toString(Internal.UTF_8), in testToString_returnsCanonicalEmptyString()
436 ByteString.wrap(new byte[] {}).toString(Internal.UTF_8)); in testToString_returnsCanonicalEmptyString()
441 ByteString.EMPTY.toString("invalid"); in testToString_raisesException()
[all …]
DWireFormatTest.java67 ByteString rawBytes = message.toByteString(); in testSerialization()
78 ByteString rawBytes = message.toByteString(); in testSerializationPacked()
92 ByteString rawBytes = message.toByteString(); in testSerializeExtensions()
104 ByteString rawBytes = message.toByteString(); in testSerializePackedExtensions()
107 ByteString rawBytes2 = message2.toByteString(); in testSerializePackedExtensions()
138 ByteString rawBytes = message.toByteString(); in testParseExtensions()
150 ByteString rawBytes = message.toByteString(); in testParsePackedExtensions()
178 private void assertFieldsInOrder(ByteString data) throws Exception { in assertFieldsInOrder()
197 ByteString data = in testInterleavedFieldsAndExtensions()
209 ByteString dynamicData = in testInterleavedFieldsAndExtensions()
[all …]
/third_party/protobuf/csharp/src/Google.Protobuf.Test/
DByteStringTest.cs48 ByteString b1 = ByteString.CopyFrom(1, 2, 3); in Equality()
49 ByteString b2 = ByteString.CopyFrom(1, 2, 3); in Equality()
50 ByteString b3 = ByteString.CopyFrom(1, 2, 4); in Equality()
51 ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); in Equality()
63 Assert.IsTrue((ByteString) null == null); in Equality()
70 Assert.IsFalse((ByteString) null != null); in Equality()
76 Assert.AreEqual(0, ByteString.Empty.Length); in EmptyByteStringHasZeroSize()
82 ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); in CopyFromStringWithExplicitEncoding()
93 Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); in IsEmptyWhenEmpty()
99 Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); in IsEmptyWhenNotEmpty()
[all …]
/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/
DByteStringTest.java34 import com.google.protobuf.ByteString.Output;
92 ByteString substring = ByteString.copyFrom(bytes).substring(500); in testSubstring_BeginIndex()
99 ByteString byteString = ByteString.copyFrom(bytes, 500, 200); in testCopyFrom_BytesOffsetSize()
106 ByteString byteString = ByteString.copyFrom(bytes); in testCopyFrom_Bytes()
116 ByteString byteString = ByteString.copyFrom(byteBuffer, 200); in testCopyFrom_ByteBufferSize()
126 ByteString byteString = ByteString.copyFrom(byteBuffer); in testCopyFrom_ByteBuffer()
133 ByteString byteString = ByteString.copyFrom(testString, UTF_16); in testCopyFrom_StringEncoding()
141 ByteString byteString = ByteString.copyFromUtf8(testString); in testCopyFrom_Utf8()
149 final List<ByteString> pieces = makeConcretePieces(testBytes); in testCopyFrom_Iterable()
151 ByteString byteString = ByteString.copyFrom(pieces); in testCopyFrom_Iterable()
[all …]
DLazyStringEndToEndTest.java49 private static ByteString TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8 =
50 ByteString.copyFrom(new byte[] {
54 private ByteString encodedTestAllTypes;
74 ByteString bytes = tV2.toByteString(); in testParseAndSerialize()
91 ByteString.copyFrom(sink)); in testParseAndWrite()
97 ByteString optional = proto.getOptionalStringBytes(); in testNoStringCachingIfOnlyBytesAccessed()
101 ByteString repeated0 = proto.getRepeatedStringBytes(0); in testNoStringCachingIfOnlyBytesAccessed()
102 ByteString repeated1 = proto.getRepeatedStringBytes(1); in testNoStringCachingIfOnlyBytesAccessed()
DRopeByteStringTest.java53 Iterator<ByteString> iter = ByteStringTest.makeConcretePieces(referenceBytes).iterator(); in setUp()
67 ByteString concatenated = ByteString.EMPTY; in testBalance()
69 concatenated = concatenated.concat(ByteString.copyFrom(testBytes, i * pieceSize, pieceSize)); in testBalance()
76 ByteString testString = ByteString.copyFrom(testBytes); in testBalance()
DWireFormatTest.java60 ByteString rawBytes = message.toByteString(); in testSerialization()
71 ByteString rawBytes = message.toByteString(); in testSerializationPacked()
85 ByteString rawBytes = message.toByteString(); in testSerializeExtensions()
97 ByteString rawBytes = message.toByteString(); in testSerializePackedExtensions()
100 ByteString rawBytes2 = message2.toByteString(); in testSerializePackedExtensions()
133 ByteString rawBytes = message.toByteString(); in testParseExtensions()
146 ByteString rawBytes = message.toByteString(); in testParsePackedExtensions()
180 private void assertFieldsInOrder(ByteString data) throws Exception { in assertFieldsInOrder()
199 ByteString data = in testInterleavedFieldsAndExtensions()
210 ByteString dynamic_data = in testInterleavedFieldsAndExtensions()
[all …]
/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/
DByteStringTest.cs44 ByteString b1 = ByteString.CopyFrom(1, 2, 3); in Equality()
45 ByteString b2 = ByteString.CopyFrom(1, 2, 3); in Equality()
46 ByteString b3 = ByteString.CopyFrom(1, 2, 4); in Equality()
47 ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); in Equality()
59 Assert.IsTrue((ByteString) null == null); in Equality()
66 Assert.IsFalse((ByteString) null != null); in Equality()
72 Assert.AreEqual(0, ByteString.Empty.Length); in EmptyByteStringHasZeroSize()
78 ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); in CopyFromStringWithExplicitEncoding()
89 Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); in IsEmptyWhenEmpty()
95 Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); in IsEmptyWhenNotEmpty()
[all …]
/third_party/protobuf/js/experimental/runtime/
Dbytestring_test.js4 const ByteString = goog.require('protobuf.ByteString'); constant
8 const /** !ByteString */ TEST_STRING = ByteString.fromArrayBuffer(TEST_BYTES);
24 ByteString.fromArrayBuffer(arrayBufferSlice(TEST_BYTES, 0));
31 ByteString.fromArrayBufferView(new Uint8Array(TEST_BYTES));
37 const byteString = ByteString.fromArrayBufferView(
46 const byteString = ByteString.fromUint8ArrayUnsafe(array);
52 const byteString = ByteString.fromBase64String(HALLO_IN_BASE64);
66 const byteString = ByteString.fromArrayBuffer(buffer);
89 const byteString = ByteString.fromArrayBufferView(array);
110 const byteString = ByteString.fromUint8ArrayUnsafe(array);
[all …]
Dbytestring.js15 class ByteString { class
39 return new ByteString(/* bytes */ null, value);
50 return new ByteString(
61 return new ByteString(cloneArrayBufferView(bytes), /* base64 */ null);
78 return new ByteString(bytes, /* base64 */ null);
123 if (!(other instanceof ByteString)) {
181 ByteString.EMPTY = new ByteString(new Uint8Array(0), null);
183 exports = ByteString;
/third_party/protobuf/csharp/src/Google.Protobuf/
DByteString.cs52 public sealed class ByteString : IEnumerable<byte>, IEquatable<ByteString> class
54 private static readonly ByteString empty = new ByteString(new byte[0]);
67 internal static ByteString FromBytes(byte[] bytes) in FromBytes()
69 return new ByteString(bytes); in FromBytes()
76 internal static ByteString AttachBytes(byte[] bytes) in AttachBytes()
78 return new ByteString(bytes); in AttachBytes()
85 private ByteString(byte[] bytes) in ByteString() method in Google.Protobuf.ByteString
93 public static ByteString Empty
164 public static ByteString FromBase64(string bytes) in FromBase64()
168 return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes)); in FromBase64()
[all …]
/third_party/protobuf/java/core/src/main/java/com/google/protobuf/
DByteString.java76 public abstract class ByteString implements Iterable<Byte>, Serializable { class
94 public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY);
145 ByteString() {} in ByteString() method in ByteString
262 private static final Comparator<ByteString> UNSIGNED_LEXICOGRAPHICAL_COMPARATOR =
263 new Comparator<ByteString>() {
265 public int compare(ByteString former, ByteString latter) {
295 public static Comparator<ByteString> unsignedLexicographicalComparator() { in unsignedLexicographicalComparator()
309 public final ByteString substring(int beginIndex) { in substring()
322 public abstract ByteString substring(int beginIndex, int endIndex); in substring()
332 public final boolean startsWith(ByteString prefix) { in startsWith()
[all …]
DLazyStringArrayList.java115 } else if (o instanceof ByteString) { in get()
116 ByteString bs = (ByteString) o; in get()
151 private void add(int index, ByteString element) { in add()
185 public boolean addAllByteString(Collection<? extends ByteString> values) { in addAllByteString()
216 public void add(ByteString element) { in add()
235 public ByteString getByteString(int index) { in getByteString()
237 ByteString b = asByteString(o); in getByteString()
255 public void set(int index, ByteString s) { in set()
259 private Object setAndReturn(int index, ByteString s) { in setAndReturn()
277 } else if (o instanceof ByteString) { in asString()
[all …]
DRopeByteString.java68 final class RopeByteString extends ByteString {
134 private final ByteString left;
135 private final ByteString right;
146 private RopeByteString(ByteString left, ByteString right) { in RopeByteString()
167 static ByteString concatenate(ByteString left, ByteString right) { in concatenate()
177 if (newLength < ByteString.CONCATENATE_BY_COPY_SIZE) { in concatenate()
196 ByteString newRight = concatenateBytes(leftRope.right, right); in concatenate()
207 ByteString newRight = new RopeByteString(leftRope.right, right); in concatenate()
230 private static ByteString concatenateBytes(ByteString left, ByteString right) { in concatenateBytes()
236 return ByteString.wrap(bytes); // Constructor wraps bytes in concatenateBytes()
[all …]
DUnsafeByteOperations.java74 public static ByteString unsafeWrap(byte[] buffer) { in unsafeWrap()
75 return ByteString.wrap(buffer); in unsafeWrap()
87 public static ByteString unsafeWrap(byte[] buffer, int offset, int length) { in unsafeWrap()
88 return ByteString.wrap(buffer, offset, length); in unsafeWrap()
97 public static ByteString unsafeWrap(ByteBuffer buffer) { in unsafeWrap()
98 return ByteString.wrap(buffer); in unsafeWrap()
117 public static void unsafeWriteTo(ByteString bytes, ByteOutput output) throws IOException { in unsafeWriteTo()
DLazyFieldLite.java94 private ByteString delayedBytes;
115 private volatile ByteString memoizedBytes;
118 public LazyFieldLite(ExtensionRegistryLite extensionRegistry, ByteString bytes) { in LazyFieldLite()
178 return memoizedBytes == ByteString.EMPTY in containsDefaultInstance()
179 || value == null && (delayedBytes == null || delayedBytes == ByteString.EMPTY); in containsDefaultInstance()
331 MessageLite value, ByteString otherBytes, ExtensionRegistryLite extensionRegistry) { in mergeValueAndBytes()
342 public void setByteString(ByteString bytes, ExtensionRegistryLite extensionRegistry) { in setByteString()
369 public ByteString toByteString() { in toByteString()
383 memoizedBytes = ByteString.EMPTY; in toByteString()
400 writer.writeBytes(fieldNumber, ByteString.EMPTY); in writeTo()
[all …]
/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/
DSentinelOuterClass.java74 com.google.protobuf.ByteString
95 com.google.protobuf.ByteString getDefaultBytes(); in getDefaultBytes()
117 defaultBytes_ = com.google.protobuf.ByteString.EMPTY; in Sentinel()
207 com.google.protobuf.ByteString bs = in getDefaultString()
208 (com.google.protobuf.ByteString) ref; in getDefaultString()
219 public com.google.protobuf.ByteString
223 com.google.protobuf.ByteString b = in getDefaultStringBytes()
224 com.google.protobuf.ByteString.copyFromUtf8( in getDefaultStringBytes()
229 return (com.google.protobuf.ByteString) ref; in getDefaultStringBytes()
261 private com.google.protobuf.ByteString defaultBytes_;
[all …]

12345678910