object Buffer extends Object
- Annotations
- @native() @JSGlobal()
- Alphabetic
- By Inheritance
- Buffer
- Object
- Any
- 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 alloc(size: Int): Buffer
- def alloc(size: Int, fill: Int): Buffer
- def alloc(size: Int, fill: Uint8Array): Buffer
- def alloc(size: Int, fill: String): Buffer
-
def
alloc(size: Int, fill: String, encoding: String): Buffer
Allocates a new
Buffer
ofsize
bytes.Allocates a new
Buffer
ofsize
bytes. Iffill
isundefined
, theBuffer
will be zero-filled.- size
The desired length of the new
Buffer
- fill
A value to pre-fill the new
Buffer
with. Default:0
- encoding
If fill
is a string, this is its encoding. Default:
'utf8'
-
def
allocUnsafe(size: Int): Buffer
Allocates a new
Buffer
ofsize
bytes.Allocates a new
Buffer
ofsize
bytes. Ifsize
is larger than constants.MAX_LENGTH or smaller than0
,ERR_INVALID_OPT_VALUE
is thrown. A zero-lengthBuffer
is created if size is0
.- size
The desired length of the new
Buffer
.
-
def
allocUnsafeSlow(size: Int): Buffer
Allocates a new
Buffer
ofsize
bytes.Allocates a new
Buffer
ofsize
bytes. Ifsize
is larger than constants.MAX_LENGTH or smaller than0
,ERR_INVALID_OPT_VALUE
is thrown. A zero-lengthBuffer
is created if size is0
.- size
The desired length of the new
Buffer
.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def byteLength(string: ArrayBuffer): Int
- def byteLength(string: DataView): Int
- def byteLength(string: TypedArray[_, _]): Int
- def byteLength(string: String): Int
-
def
byteLength(string: String, encoding: String): Int
Returns the actual byte length of a string.
Returns the actual byte length of a string. This is not the same as
String.prototype.length
since that returns the number of characters in a string.- string
A value to calculate the length of.
- encoding
If string
is a string, this is its encoding. Default:
'utf8'.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
compare(buf1: Uint8Array, buf2: Uint8Array): Int
Compares
buf1
tobuf2
typically for the purpose of sorting arrays ofBuffer
instances.Compares
buf1
tobuf2
typically for the purpose of sorting arrays ofBuffer
instances. This is equivalent to callingbuf1.compare(buf2)
. - def concat[B <: Uint8Array](list: Array[B]): Buffer
-
def
concat[B <: Uint8Array](list: Array[B], totalLength: Int): Buffer
Returns a new
Buffer
which is the result of concatenating all theBuffer
s in thelist
together.Returns a new
Buffer
which is the result of concatenating all theBuffer
s in thelist
together.- list
List of Buffer or Uint8Array instances to concat.
- totalLength
Total length of the
Buffer
instances inlist
when concatenated.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
from(str: String): Buffer
Creates a new
Buffer
containingstring
.Creates a new
Buffer
containingstring
. UTF-8 encoding is used.- str
A string to encode.
-
def
from(str: String, encoding: String): Buffer
Creates a new
Buffer
containingstring
.Creates a new
Buffer
containingstring
. Theencoding
parameter identifies the character encoding ofstring
.- str
A string to encode.
- encoding
The encoding of string. Default: 'utf8'.
-
def
from(array: Array[Int]): Buffer
Allocates a new
Buffer
using anarray
of octets.Allocates a new
Buffer
using anarray
of octets. -
def
from(buffer: Uint8Array): Buffer
Copies the passed
buffer
data onto a newBuffer
instance.Copies the passed
buffer
data onto a newBuffer
instance.- buffer
An existing Buffer or Uint8Array from which to copy data.
- def from(arrayBuffer: ArrayBuffer): Buffer
- def from(arrayBuffer: ArrayBuffer, byteOffset: Int): Buffer
-
def
from(arrayBuffer: ArrayBuffer, byteOffset: Int, length: Int): Buffer
When passed a reference to the .buffer property of a TypedArray instance, the newly created Buffer will share the same allocated memory as the TypedArray.
When passed a reference to the .buffer property of a TypedArray instance, the newly created Buffer will share the same allocated memory as the TypedArray.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isBuffer(obj: Object): Boolean
Returns
true
ifobj
is aBuffer
,false
otherwise.Returns
true
ifobj
is aBuffer
,false
otherwise.- obj
the given object
-
def
isEncoding(encoding: String): Boolean
Returns true if
encoding
contains a supported character encoding, or false otherwise.Returns true if
encoding
contains a supported character encoding, or false otherwise. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
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()
-
var
poolSize: Int
This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling.
This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
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()