Code formatting changes as requested by Victor
This commit is contained in:
parent
34e469c609
commit
60c7a57ddf
2 changed files with 10 additions and 24 deletions
|
|
@ -58,11 +58,11 @@ object ByteIterator {
|
|||
final override def length: Int = { val l = len; clear(); l }
|
||||
|
||||
final override def ++(that: TraversableOnce[Byte]): ByteIterator = that match {
|
||||
case that: ByteIterator ⇒ {
|
||||
case that: ByteIterator ⇒
|
||||
if (that.isEmpty) this
|
||||
else if (this.isEmpty) that
|
||||
else that match {
|
||||
case that: ByteArrayIterator ⇒ {
|
||||
case that: ByteArrayIterator ⇒
|
||||
if ((this.array eq that.array) && (this.until == that.from)) {
|
||||
this.until = that.until
|
||||
that.clear()
|
||||
|
|
@ -72,10 +72,8 @@ object ByteIterator {
|
|||
this.clear()
|
||||
result
|
||||
}
|
||||
}
|
||||
case that: MultiByteArrayIterator ⇒ this +: that
|
||||
}
|
||||
}
|
||||
case _ ⇒ super.++(that)
|
||||
}
|
||||
|
||||
|
|
@ -230,24 +228,21 @@ object ByteIterator {
|
|||
}
|
||||
|
||||
final override def ++(that: TraversableOnce[Byte]): ByteIterator = that match {
|
||||
case that: ByteIterator ⇒ {
|
||||
case that: ByteIterator ⇒
|
||||
if (that.isEmpty) this
|
||||
else if (this.isEmpty) that
|
||||
else {
|
||||
that match {
|
||||
case that: ByteArrayIterator ⇒ {
|
||||
case that: ByteArrayIterator ⇒
|
||||
iterators = this.iterators :+ that
|
||||
that.clear()
|
||||
this
|
||||
}
|
||||
case that: MultiByteArrayIterator ⇒ {
|
||||
case that: MultiByteArrayIterator ⇒
|
||||
iterators = this.iterators ++ that.iterators
|
||||
that.clear()
|
||||
this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case _ ⇒ super.++(that)
|
||||
}
|
||||
|
||||
|
|
@ -410,10 +405,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] {
|
|||
|
||||
protected def clear(): Unit
|
||||
|
||||
def ++(that: TraversableOnce[Byte]): ByteIterator = {
|
||||
if (that.isEmpty) this
|
||||
else ByteIterator.ByteArrayIterator(that.toArray)
|
||||
}
|
||||
def ++(that: TraversableOnce[Byte]): ByteIterator = if (that.isEmpty) this else ByteIterator.ByteArrayIterator(that.toArray)
|
||||
|
||||
// *must* be overridden by derived classes. This construction is necessary
|
||||
// to specialize the return type, as the method is already implemented in
|
||||
|
|
|
|||
|
|
@ -142,11 +142,10 @@ object ByteString {
|
|||
else if (this.isEmpty) that
|
||||
else that match {
|
||||
case b: ByteString1C ⇒ ByteStrings(this, b.toByteString1)
|
||||
case b: ByteString1 ⇒ {
|
||||
case b: ByteString1 ⇒
|
||||
if ((bytes eq b.bytes) && (startIndex + length == b.startIndex))
|
||||
new ByteString1(bytes, startIndex, length + b.length)
|
||||
else ByteStrings(this, b)
|
||||
}
|
||||
case bs: ByteStrings ⇒ ByteStrings(this, bs)
|
||||
}
|
||||
}
|
||||
|
|
@ -223,10 +222,7 @@ object ByteString {
|
|||
}
|
||||
}
|
||||
|
||||
def isCompact: Boolean = {
|
||||
if (bytestrings.length == 1) bytestrings.head.isCompact
|
||||
else false
|
||||
}
|
||||
def isCompact: Boolean = if (bytestrings.length == 1) bytestrings.head.isCompact else false
|
||||
|
||||
def compact: CompactByteString = {
|
||||
if (isCompact) bytestrings.head.compact
|
||||
|
|
@ -555,7 +551,7 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
|
|||
*/
|
||||
def putInt(x: Int)(implicit byteOrder: ByteOrder): this.type = {
|
||||
fillArray(4) {
|
||||
case (target, offset) ⇒ {
|
||||
case (target, offset) ⇒
|
||||
if (byteOrder == ByteOrder.BIG_ENDIAN) {
|
||||
target(offset + 0) = (x >>> 24).toByte
|
||||
target(offset + 1) = (x >>> 16).toByte
|
||||
|
|
@ -567,7 +563,6 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
|
|||
target(offset + 2) = (x >>> 16).toByte
|
||||
target(offset + 3) = (x >>> 24).toByte
|
||||
} else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
||||
}
|
||||
}
|
||||
this
|
||||
}
|
||||
|
|
@ -577,7 +572,7 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
|
|||
*/
|
||||
def putLong(x: Long)(implicit byteOrder: ByteOrder): this.type = {
|
||||
fillArray(8) {
|
||||
case (target, offset) ⇒ {
|
||||
case (target, offset) ⇒
|
||||
if (byteOrder == ByteOrder.BIG_ENDIAN) {
|
||||
target(offset + 0) = (x >>> 56).toByte
|
||||
target(offset + 1) = (x >>> 48).toByte
|
||||
|
|
@ -597,7 +592,6 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
|
|||
target(offset + 6) = (x >>> 48).toByte
|
||||
target(offset + 7) = (x >>> 56).toByte
|
||||
} else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
||||
}
|
||||
}
|
||||
this
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue