Lines Matching refs:bytes

50     /// Immutable array of bytes.

56 private readonly byte[] bytes;
67 internal static ByteString FromBytes(byte[] bytes)
69 return new ByteString(bytes);
76 internal static ByteString AttachBytes(byte[] bytes)
78 return new ByteString(bytes);
85 private ByteString(byte[] bytes)
87 this.bytes = bytes;
99 /// Returns the length of this ByteString in bytes.
103 get { return bytes.Length; }
124 return new ReadOnlySpan<byte>(bytes);
137 return new ReadOnlyMemory<byte>(bytes);
149 return (byte[]) bytes.Clone();
158 return Convert.ToBase64String(bytes);
164 public static ByteString FromBase64(string bytes)
168 return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes));
185 byte[] bytes = memoryStream.ToArray();
188 byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray();
190 return AttachBytes(bytes);
211 byte[] bytes = memoryStream.ToArray();
214 byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray();
216 return AttachBytes(bytes);
227 public static ByteString CopyFrom(params byte[] bytes)
229 return new ByteString((byte[]) bytes.Clone());
235 public static ByteString CopyFrom(byte[] bytes, int offset, int count)
238 ByteArray.Copy(bytes, offset, portion, 0, count);
248 public static ByteString CopyFrom(ReadOnlySpan<byte> bytes)
250 return new ByteString(bytes.ToArray());
276 get { return bytes[index]; }
290 return encoding.GetString(bytes, 0, bytes.Length);
307 /// Returns an iterator over the bytes in this <see cref="ByteString"/>.
309 /// <returns>An iterator over the bytes in this object.</returns>
312 return ((IEnumerable<byte>) bytes).GetEnumerator();
316 /// Returns an iterator over the bytes in this <see cref="ByteString"/>.
318 /// <returns>An iterator over the bytes in this object.</returns>
330 return new CodedInputStream(bytes);
349 if (lhs.bytes.Length != rhs.bytes.Length)
355 if (rhs.bytes[i] != lhs.bytes[i])
392 foreach (byte b in bytes)
414 outputStream.WriteRawBytes(bytes, 0, bytes.Length);
422 ByteArray.Copy(bytes, 0, array, position, bytes.Length);
430 outputStream.Write(bytes, 0, bytes.Length);