title: Google Protobuf ByteString vs. Byte[]
body: <p>I am working with google protobuf in Java. 
  I see that it is possible to serialize a protobuf message to String, byte[], ByteString, etc:
  (Source: <a href="https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/MessageLite">https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/MessageLite</a>)</p>
  
  <p>I don't know what a ByteString is. I got the following definition from the the protobuf API documentation (source: <a href="https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/ByteString">https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/ByteString</a>):
  "Immutable sequence of bytes. Substring is supported by sharing the reference to the immutable underlying bytes, as with String."</p>
  
  <p>It is not clear to me how a ByteString is different from a String or byte[].
  Can somebody please explain?
  Thanks.</p>