-#15825 add isEmpty and nonEmpty to ByteStringBuilder

This commit is contained in:
hepin 2015-03-28 13:34:47 +08:00
parent 213a5a4300
commit 954a86bf80
2 changed files with 24 additions and 0 deletions

View file

@ -789,4 +789,14 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
override def write(b: Array[Byte], off: Int, len: Int): Unit = { builder.putBytes(b, off, len) }
}
/**
* Tests whether this ByteStringBuilder is empty.
*/
def isEmpty: Boolean = _length == 0
/**
* Tests whether this ByteStringBuilder is not empty.
*/
def nonEmpty: Boolean = _length > 0
}