mdedetrich commented on code in PR #1085:
URL: https://github.com/apache/incubator-pekko/pull/1085#discussion_r1472663426
##########
actor/src/main/scala-2.12/org/apache/pekko/util/ByteString.scala:
##########
@@ -827,6 +836,16 @@ sealed abstract class ByteString extends IndexedSeq[Byte]
with IndexedSeqOptimiz
*/
def toArrayUnsafe(): Array[Byte] = toArray
+ /**
+ * Return the bytes in this ByteString as an InputStream.
+ *
+ * @return the bytes in this ByteString accessible as an InputStream
+ * @see [[asByteBuffer]]
+ * @since 1.1.0
+ */
+ def asInputStream: InputStream =
+ new SequenceInputStream(asByteBuffers.map(bb => new
ByteBufferBackedInputStream(bb)).iterator.asJavaEnumeration)
Review Comment:
Agreed as it forces you to implement it for all subtypes which avoids
leaving in a default sub-optimal (in terms of performance) implementation if a
subtype happens to miss an implementation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]