|
@@ -39,6 +39,9 @@ class BytesBuffer {
|
|
var b : Array<Int>;
|
|
var b : Array<Int>;
|
|
#end
|
|
#end
|
|
|
|
|
|
|
|
+ /** The length of the buffer in bytes. **/
|
|
|
|
+ public var length(get,never) : Int;
|
|
|
|
+
|
|
public function new() {
|
|
public function new() {
|
|
#if neko
|
|
#if neko
|
|
b = untyped StringBuf.__make();
|
|
b = untyped StringBuf.__make();
|
|
@@ -57,6 +60,18 @@ class BytesBuffer {
|
|
#end
|
|
#end
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ inline function get_length() : Int {
|
|
|
|
+ #if neko
|
|
|
|
+ return untyped __dollar__ssize( StringBuf.__to_string(b) );
|
|
|
|
+ #elseif cs
|
|
|
|
+ return haxe.Int64.toInt( b.Length );
|
|
|
|
+ #elseif java
|
|
|
|
+ return b.size();
|
|
|
|
+ #else
|
|
|
|
+ return b.length;
|
|
|
|
+ #end
|
|
|
|
+ }
|
|
|
|
+
|
|
public inline function addByte( byte : Int ) {
|
|
public inline function addByte( byte : Int ) {
|
|
#if neko
|
|
#if neko
|
|
untyped StringBuf.__add_char(b,byte);
|
|
untyped StringBuf.__add_char(b,byte);
|