Removed unnecessary implementations of ByteString.clone
* As all ByteString implementations are immutable, an explicit override of Object.clone doesn't seem necessary.
This commit is contained in:
parent
b285b0821f
commit
5b83dc366e
1 changed files with 1 additions and 5 deletions
|
|
@ -79,8 +79,6 @@ object ByteString {
|
|||
|
||||
private[akka] def toByteString1: ByteString1 = ByteString1(bytes)
|
||||
|
||||
override def clone: ByteString1C = new ByteString1C(toArray)
|
||||
|
||||
def asByteBuffer: ByteBuffer =
|
||||
toByteString1.asByteBuffer
|
||||
|
||||
|
|
@ -121,12 +119,10 @@ object ByteString {
|
|||
throw new IndexOutOfBoundsException(index.toString)
|
||||
}
|
||||
|
||||
override def clone: CompactByteString = ByteString1C(toArray)
|
||||
|
||||
def isCompact: Boolean = (length == bytes.length)
|
||||
|
||||
def compact: CompactByteString =
|
||||
if (isCompact) ByteString1C(bytes) else clone
|
||||
if (isCompact) ByteString1C(bytes) else ByteString1C(toArray)
|
||||
|
||||
def asByteBuffer: ByteBuffer = {
|
||||
val buffer = ByteBuffer.wrap(bytes, startIndex, length).asReadOnlyBuffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue