object BitVector extends Serializable
- Grouped
- Alphabetic
- By Inheritance
- BitVector
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply[A](bytes: A*)(implicit arg0: Integral[A]): BitVector
Constructs a
BitVectorfrom a list of literal bytes.Constructs a
BitVectorfrom a list of literal bytes. Only the least significant byte is used of each integral value. -
def
apply(bs: bits.IterableOnce[Byte]): BitVector
Constructs a
BitVectorfrom a collection of bytes. -
def
apply(bs: Array[Byte]): BitVector
Constructs a
BitVectorfrom anArray[Byte].Constructs a
BitVectorfrom anArray[Byte]. The givenArray[Byte]is is copied to ensure the resultingBitVectoris immutable. If this is not desired, useBitVector.view. -
def
apply(buffer: ByteBuffer): BitVector
Constructs a
BitVectorfrom aByteBuffer.Constructs a
BitVectorfrom aByteBuffer. The givenByteBufferis is copied to ensure the resultingBitVectoris immutable. If this is not desired, useBitVector.view. -
def
apply(bs: ByteVector): BitVector
Constructs a
BitVectorfrom aByteVector.Constructs a
BitVectorfrom aByteVector. This method has runtime O(1). -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bit(high: Boolean): BitVector
1-bit vector with only bit set to specified value.
-
def
bits(b: Iterable[Boolean]): BitVector
n-bit vector with bit at index
iset to value of boolean at indexiin specified iterable. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
concat(vs: Vector[BitVector]): BitVector
Concatenate
vsto produce a singleBitVector. -
def
concat(bvs: bits.IterableOnce[BitVector]): BitVector
Concatenates all the given
BitVectors into a single instance. -
val
empty: BitVector
Empty bit vector.
-
def
encodeAscii(str: String): Either[CharacterCodingException, BitVector]
Encodes the specified string to a
BitVectorusing the US-ASCII charset. -
def
encodeString(str: String)(implicit charset: Charset): Either[CharacterCodingException, BitVector]
Encodes the specified string to a
BitVectorusing the implicitly availableCharset. -
def
encodeUtf8(str: String): Either[CharacterCodingException, BitVector]
Encodes the specified string to a
BitVectorusing the UTF-8 charset. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fill(n: Long)(high: Boolean): BitVector
Constructs an
n-bitBitVectorwhere each bit is set to the specified value. -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fromBase58(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): Option[BitVector]
Constructs a
BitVectorfrom a base 58 string or returnsNoneif the string is not valid base 58.Constructs a
BitVectorfrom a base 58 string or returnsNoneif the string is not valid base 58. Details pertaining to base 58 decoding can be found in the comment for ByteVector.fromBase58Descriptive. The string may contain whitespace characters which are ignored. -
def
fromBase58Descriptive(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): Either[String, BitVector]
Constructs a
BitVectorfrom a base 58 string or returns an error message if the string is not valid base 58.Constructs a
BitVectorfrom a base 58 string or returns an error message if the string is not valid base 58. Details pertaining to base 58 decoding can be found in the comment for ByteVector.fromBase58Descriptive. The string may contain whitespace characters which are ignored. -
def
fromBase64(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): Option[BitVector]
Constructs a
BitVectorfrom a base 64 string or returnsNoneif the string is not valid base 64.Constructs a
BitVectorfrom a base 64 string or returnsNoneif the string is not valid base 64. Details pertaining to base 64 decoding can be found in the comment for ByteVector.fromBase64Descriptive. The string may contain whitespace characters which are ignored. -
def
fromBase64Descriptive(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): Either[String, BitVector]
Constructs a
BitVectorfrom a base 64 string or returns an error message if the string is not valid base 64.Constructs a
BitVectorfrom a base 64 string or returns an error message if the string is not valid base 64. Details pertaining to base 64 decoding can be found in the comment for ByteVector.fromBase64Descriptive. The string may contain whitespace characters which are ignored. -
def
fromBin(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): Option[BitVector]
Constructs a
BitVectorfrom a binary string or returnsNoneif the string is not valid binary.Constructs a
BitVectorfrom a binary string or returnsNoneif the string is not valid binary.The string may start with a
0band it may contain whitespace or underscore characters. -
def
fromBinDescriptive(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): Either[String, BitVector]
Constructs a
BitVectorfrom a binary string or returns an error message if the string is not valid binary.Constructs a
BitVectorfrom a binary string or returns an error message if the string is not valid binary.The string may start with a
0band it may contain whitespace or underscore characters. -
def
fromByte(b: Byte, size: Int = 8): BitVector
Constructs a bit vector with the 2's complement encoding of the specified byte.
Constructs a bit vector with the 2's complement encoding of the specified byte.
- size
size of vector (<= 8)
-
def
fromChannel(in: ReadableByteChannel, chunkSizeInBytes: Int = 1024 * 1000 * 16, direct: Boolean = false): BitVector
Produce a lazy
BitVectorfrom the givenReadableByteChannel, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB).Produce a lazy
BitVectorfrom the givenReadableByteChannel, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB). This function does lazy I/O, see scodec.bits.BitVector.fromInputStream for caveats. Thedirectparameter, iftrue, allows for (but does not enforce) using a 'direct'java.nio.ByteBufferfor each chunk, which means the buffer and correspondingBitVectorchunk may be backed by a 'view' rather than an in-memory array. This may be more efficient for some workloads. Seejava.nio.ByteBufferfor more information.- chunkSizeInBytes
the number of bytes to read in each chunk
- direct
true if we should attempt to use a 'direct'
java.nio.ByteBufferfor reads
-
def
fromHex(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): Option[BitVector]
Constructs a
BitVectorfrom a hexadecimal string or returnsNoneif the string is not valid hexadecimal.Constructs a
BitVectorfrom a hexadecimal string or returnsNoneif the string is not valid hexadecimal.The string may start with a
0xand it may contain whitespace or underscore characters. -
def
fromHexDescriptive(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): Either[String, BitVector]
Constructs a
BitVectorfrom a hexadecimal string or returns an error message if the string is not valid hexadecimal.Constructs a
BitVectorfrom a hexadecimal string or returns an error message if the string is not valid hexadecimal.The string may start with a
0xand it may contain whitespace or underscore characters. -
def
fromInputStream(in: InputStream, chunkSizeInBytes: Int = 1024 * 1000 * 16): BitVector
Produce a lazy
BitVectorfrom the givenInputStream, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB).Produce a lazy
BitVectorfrom the givenInputStream, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB). This simply calls scodec.bits.BitVector.unfold with a function to extract a series of flat byte arrays from theInputStream.This function does not handle closing the
InputStreamand has all the usual drawbacks of lazy I/O -I/Oexceptions may be raised unexpectedly in pure code as chunks are forced, and it must memoize the results to prevent the underlying side effects from being observed. Streaming applications should take care to ensure that the head of the stream is not left on the stack, as this will cause the entire stream to be retained in memory.- chunkSizeInBytes
the number of bytes to read in each chunk
-
def
fromInt(i: Int, size: Int = 32, ordering: ByteOrdering = ByteOrdering.BigEndian): BitVector
Constructs a bit vector with the 2's complement encoding of the specified value.
Constructs a bit vector with the 2's complement encoding of the specified value.
- i
value to encode
- size
size of vector (<= 32)
- ordering
byte ordering of vector
-
def
fromLong(l: Long, size: Int = 64, ordering: ByteOrdering = ByteOrdering.BigEndian): BitVector
Constructs a bit vector with the 2's complement encoding of the specified value.
Constructs a bit vector with the 2's complement encoding of the specified value.
- size
size of vector (<= 64)
- ordering
byte ordering of vector
-
def
fromMmap(in: FileChannel, chunkSizeInBytes: Int = 1024 * 1000 * 16): BitVector
Produce a lazy
BitVectorfrom the givenFileChannel, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB).Produce a lazy
BitVectorfrom the givenFileChannel, usingchunkSizeInBytesto control the number of bytes read in each chunk (defaulting to 16MB). Unlike scodec.bits.BitVector.fromChannel, this memory-maps chunks in, rather than copying them explicitly.Behavior is unspecified if this function is used concurrently with the underlying file being written.
- chunkSizeInBytes
the number of bytes to read in each chunk
-
def
fromShort(s: Short, size: Int = 16, ordering: ByteOrdering = ByteOrdering.BigEndian): BitVector
Constructs a bit vector with the 2's complement encoding of the specified value.
Constructs a bit vector with the 2's complement encoding of the specified value.
- s
value to encode
- size
size of vector (<= 16)
- ordering
byte ordering of vector
-
final
def
fromUUID(u: UUID): BitVector
Constructs a bit vector containing the binary representation of the specified UUID.
Constructs a bit vector containing the binary representation of the specified UUID. The bits are in MSB-to-LSB order.
- u
value to encode
-
def
fromValidBase58(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): BitVector
Constructs a
BitVectorfrom a base 58 string or throws an IllegalArgumentException if the string is not valid base 58.Constructs a
BitVectorfrom a base 58 string or throws an IllegalArgumentException if the string is not valid base 58. Details pertaining to base 58 decoding can be found in the comment for ByteVector.fromBase58Descriptive. The string may contain whitespace characters which are ignored.- Exceptions thrown
IllegalArgumentExceptionif the string is not valid base 58
-
def
fromValidBase64(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): BitVector
Constructs a
BitVectorfrom a base 64 string or throws an IllegalArgumentException if the string is not valid base 64.Constructs a
BitVectorfrom a base 64 string or throws an IllegalArgumentException if the string is not valid base 64. Details pertaining to base 64 decoding can be found in the comment for ByteVector.fromBase64Descriptive. The string may contain whitespace characters which are ignored.- Exceptions thrown
IllegalArgumentExceptionif the string is not valid base 64
-
def
fromValidBin(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): BitVector
Constructs a
BitVectorfrom a binary string or throws an IllegalArgumentException if the string is not valid binary.Constructs a
BitVectorfrom a binary string or throws an IllegalArgumentException if the string is not valid binary.The string may start with a
0band it may contain whitespace or underscore characters.- Exceptions thrown
IllegalArgumentExceptionif the string is not valid hexadecimal
-
def
fromValidHex(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): BitVector
Constructs a
BitVectorfrom a hexadecimal string or throws an IllegalArgumentException if the string is not valid hexadecimal.Constructs a
BitVectorfrom a hexadecimal string or throws an IllegalArgumentException if the string is not valid hexadecimal.The string may start with a
0xand it may contain whitespace or underscore characters.- Exceptions thrown
IllegalArgumentExceptionif the string is not valid hexadecimal
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
high(n: Long): BitVector
n-bit vector with all bits set high.
-
val
highByte: BitVector
8-bit vector with all bits set high.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
low(n: Long): BitVector
n-bit vector with all bits set low.
-
val
lowByte: BitVector
8-bit vector with all bits set low.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
one: BitVector
1-bit vector with only bit set high.
-
def
reverseBitsInByte(b: Byte): Byte
Returns the bitwise reversal of the provided byte.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unfold[S](s: S)(f: (S) ⇒ Option[(BitVector, S)]): BitVector
Create a lazy
BitVectorby repeatedly extracting chunks fromS.Create a lazy
BitVectorby repeatedly extracting chunks fromS. The returnedBitVectorwill have the structure of a fully lazy right-associated cons list. Thus,get,take, anddropwill be efficient when operating on the head of the list, but accessing later indices (fortakeRight, say, orget(size-1)will require forcing the stream up to that point.Use
forceif you wish to convert the result to an in-memory strictBitVectorbacked by a balanced tree. -
def
view(bs: Array[Byte], sizeInBits: Long): BitVector
Constructs a
BitVectorfrom anArray[Byte].Constructs a
BitVectorfrom anArray[Byte]. Unlikeapply, this does not make a copy of the input array, so callers should take care not to modify the contents of the array passed to this function. -
def
view(bs: Array[Byte]): BitVector
Constructs a
BitVectorfrom anArray[Byte].Constructs a
BitVectorfrom anArray[Byte]. Unlikeapply, this does not make a copy of the input array, so callers should take care not to modify the contents of the array passed to this function. -
def
view(buffer: ByteBuffer, sizeInBits: Long): BitVector
Constructs a
BitVectorfrom the firstsizeInBitsof theByteBuffer.Constructs a
BitVectorfrom the firstsizeInBitsof theByteBuffer. Unlikeapply, this does not make a copy of the input buffer, so callers should take care not to modify the contents of the buffer passed to this function. -
def
view(buffer: ByteBuffer): BitVector
Constructs a
BitVectorfrom aByteBufferusing the buffer limit * 8 as the size.Constructs a
BitVectorfrom aByteBufferusing the buffer limit * 8 as the size. Unlikeapply, this does not make a copy of the input buffer, so callers should take care not to modify the contents of the buffer passed to this function. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
zero: BitVector
1-bit vector with only bit set low.