Exemplo n.º 1
0
    public virtual object decompress(object content)
    {
        global::Array <uint> fin = new global::Array <uint>();
        {
            int _g1 = 0;
            int _g  = ((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.getField(content, "length", 520590566, true))));
            while ((_g1 < _g))
            {
                int i = _g1++;
                fin[i] = ((uint)(global::haxe.lang.Runtime.toInt(((object)(global::haxe.lang.Runtime.callField(content, "charCodeAt", 894756598, new global::Array <object>(new object[] { i })))))));
            }
        }

        global::Array <uint> fout = new global::Array <uint>();

        global::decode.streams.BrotliInput  input  = global::decode.Streams.BrotliInitMemInput(fin, fin.length);
        global::decode.streams.BrotliOutput output = global::decode.Streams.BrotliInitMemOutput(fout);
        global::decode.Decode.BrotliDecompress(input, output);
        global::haxe.io.Bytes bytes = global::haxe.io.Bytes.alloc(((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.getField(output.data_, "pos", 5594516, true)))));
        {
            int _g11 = 0;
            int _g2  = ((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.getField(output.data_, "pos", 5594516, true))));
            while ((_g11 < _g2))
            {
                int i1 = _g11++;
                bytes.b[i1] = ((byte)(((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.callField(global::haxe.lang.Runtime.getField(output.data_, "buffer", 1351924992, true), "__get", 1915412854, new global::Array <object>(new object[] { i1 })))))));
            }
        }

        return(bytes.getString(0, ((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.getField(output.data_, "pos", 5594516, true))))));
    }
Exemplo n.º 2
0
 public virtual string readString(int len, global::haxe.io.Encoding encoding)
 {
                 #line 305 "C:\\HaxeToolkit\\haxe\\std\\haxe\\io\\Input.hx"
     global::haxe.io.Bytes b = global::haxe.io.Bytes.alloc(len);
     this.readFullBytes(b, 0, len);
                 #line 310 "C:\\HaxeToolkit\\haxe\\std\\haxe\\io\\Input.hx"
     return(b.getString(0, len, encoding));
 }
Exemplo n.º 3
0
 public virtual string readString(int len, global::haxe.io.Encoding encoding)
 {
                 #line 305 "/opt/haxe/std/haxe/io/Input.hx"
     global::haxe.io.Bytes b = global::haxe.io.Bytes.alloc(len);
     this.readFullBytes(b, 0, len);
                 #line 310 "/opt/haxe/std/haxe/io/Input.hx"
     return(b.getString(0, len, encoding));
 }
Exemplo n.º 4
0
    public virtual object compress(object content, int quality)
    {
        unchecked {
            if (((quality < 0) || (quality > 11)))
            {
                global::haxe.Log.trace.__hx_invoke2_o(default(double), "Quality 0...11", default(double), new global::haxe.lang.DynamicObject(new int[] { 302979532, 1547539107, 1648581351 }, new object[] { "compress", "Brotli", "Brotli.hx" }, new int[] { 1981972957 }, new double[] { ((double)(243)) }));
                return(null);
            }

            global::Array <uint> fin = new global::Array <uint>();
            {
                int _g1 = 0;
                int _g  = ((int)(global::haxe.lang.Runtime.toInt(global::haxe.lang.Runtime.getField(content, "length", 520590566, true))));
                while ((_g1 < _g))
                {
                    int i = _g1++;
                    fin[i] = ((uint)(global::haxe.lang.Runtime.toInt(((object)(global::haxe.lang.Runtime.callField(content, "charCodeAt", 894756598, new global::Array <object>(new object[] { i })))))));
                }
            }

            global::Array <uint> fout = new global::Array <uint>();
            global::encode.encode.BrotliParams @params = new global::encode.encode.BrotliParams();
            @params.quality = quality;
            global::encode.streams.BrotliMemOut output = new global::encode.streams.BrotliMemOut(((global::Array <uint>)(fout)));
            global::encode.Encode.BrotliCompress(@params, new global::encode.streams.BrotliMemIn(fin, fin.length), output);
            global::haxe.io.Bytes bytes = global::haxe.io.Bytes.alloc(output.position());
            {
                int _g11 = 0;
                int _g2  = output.position();
                while ((_g11 < _g2))
                {
                    int i1 = _g11++;
                    bytes.b[i1] = ((byte)(((int)(output.buf_[i1]))));
                }
            }

            return(bytes.getString(0, output.position()));
        }
    }