From e1ef7a987655456d8b8c4eb0e5c25c8b3318a1bf Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 14 Sep 2018 02:20:46 -0700 Subject: [PATCH] Minor compile fix --- src/haxe/io/Bytes.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/haxe/io/Bytes.hx b/src/haxe/io/Bytes.hx index 086eecded..8af5a1f8c 100644 --- a/src/haxe/io/Bytes.hx +++ b/src/haxe/io/Bytes.hx @@ -356,7 +356,7 @@ class Bytes { setInt32(pos + 4, v.high); } - public function getString( pos : Int, len : Int ) : String { + public function getString( pos : Int, len : Int, ?encoding : Dynamic ) : String { #if !neko if( pos < 0 || len < 0 || pos + len > length ) throw Error.OutsideBounds; #end @@ -417,6 +417,9 @@ class Bytes { return getString(pos, len); } + /** + Returns string representation of the bytes as UTF8 + **/ public function toString() : String { #if neko return new String(untyped __dollar__ssub(b,0,length)); @@ -479,8 +482,11 @@ class Bytes { #end } + /** + Returns bytes representation of the given String, using specific encoding (UTF-8 by default) + **/ @:pure - public static function ofString( s : String ) : Bytes { + public static function ofString( s : String, ?encoding : Dynamic ) : Bytes { #if neko return new Bytes(s.length,untyped __dollar__ssub(s.__s,0,s.length)); #elseif flash