⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hessianoutput.as

📁 RESIN 3.2 最新源码
💻 AS
📖 第 1 页 / 共 2 页
字号:
    {      _out.writeByte('I'.charCodeAt());      _out.writeByte(value >> 24);      _out.writeByte(value >> 16);      _out.writeByte(value >> 8);      _out.writeByte(value);    }    /**     * Writes a long value to the stream.  The long will be written     * with the following syntax:     *     * <p>     *   <code><pre>     *   L b64 b56 b48 b40 b32 b24 b16 b8     *   </pre></code>     * </p>     *     * @param value The long value to write.     */    public override function writeLong(value:Number):void    {      _out.writeByte('L'.charCodeAt());      _out.writeByte(0xFF & (value >> 56));      _out.writeByte(0xFF & (value >> 48));      _out.writeByte(0xFF & (value >> 40));      _out.writeByte(0xFF & (value >> 32));      _out.writeByte(0xFF & (value >> 24));      _out.writeByte(0xFF & (value >> 16));      _out.writeByte(0xFF & (value >> 8));      _out.writeByte(0xFF & (value));    }    /**     * Writes a double value to the stream.  The double will be written     * with the following syntax:     *     * <p>     *   <code><pre>     *   D b64 b56 b48 b40 b32 b24 b16 b8     *   </pre></code>     * </p>     *     * @param value The double value to write.     */    public override function writeDouble(value:Number):void    {      var bits:ByteArray = Double.doubleToLongBits(value);      _out.writeByte('D'.charCodeAt());      _out.writeBytes(bits);    }    /**     * Writes a date to the stream.     *     * <p>     *   <code><pre>     *   T  b64 b56 b48 b40 b32 b24 b16 b8     *   </pre></code>     * </p>     *     * @param time The date in milliseconds from the epoch in UTC     */    public override function writeUTCDate(time:Number):void    {      _out.writeByte('d'.charCodeAt());      _out.writeByte(0xFF & (time / 0x100000000000000));      _out.writeByte(0xFF & (time / 0x1000000000000));      _out.writeByte(0xFF & (time / 0x10000000000));      _out.writeByte(0xFF & (time / 0x100000000));      _out.writeByte(0xFF & (time >> 24));      _out.writeByte(0xFF & (time >> 16));      _out.writeByte(0xFF & (time >> 8));      _out.writeByte(0xFF & (time));    }    /**     * Writes a null value to the stream.     * The null will be written with the following syntax     *     * <p>     *   <code><pre>     *   N     *   </pre></code>     * </p>     */    public override function writeNull():void    {      _out.writeByte('N'.charCodeAt());    }    /**     * Writes a string value to the stream using UTF-8 encoding.     * The string will be written with the following syntax:     *     * <p>     *   <code><pre>     *   S b16 b8 string-value     *   </pre></code>     * </p>     *     * <p>     *   If the value is null, it will be written as     *     *   <code><pre>     *   N     *   </pre></code>     * </p>     *     * @param value The string value to write.     * @param offset The offset in the string of where to start.     * @param length The length in the string to write.     */    public override function writeString(value:*,                                          offset:int = 0,                                          length:int = 0):void    {      if (value == null)        _out.writeByte('N'.charCodeAt());      else if (value is Array)        writeCharArray(value as Array, offset, length);      else {        length = value.length;        offset = 0;        while (length > 0x8000) {          var sublen:int = 0x8000;          // chunk can't end in high surrogate          var tail:int = value.charCodeAt(offset + sublen - 1);          if (0xd800 <= tail && tail <= 0xdbff)            sublen--;          _out.writeByte('s'.charCodeAt());          _out.writeByte(sublen >> 8);          _out.writeByte(sublen);          printString(value, offset, sublen);          length -= sublen;          offset += sublen;        }        _out.writeByte('S'.charCodeAt());        _out.writeByte(length >> 8);        _out.writeByte(length);        printString(value, offset, length);      }    }    /**     * Writes a string value to the stream using UTF-8 encoding.     * The string will be written with the following syntax:     *     * <p>     *   <code><pre>     *   S b16 b8 string-value     *   </pre></code>     * </p>     *     * <p>     *   If the value is null, it will be written as     *     *   <code><pre>     *   N     *   </pre></code>     * </p>     *     * @param buffer The character buffer value to write.     * @param offset The offset in the array of where to start.     * @param length The length in the array to write.     */    private function writeCharArray(buffer:Array, offset:int, length:int):void    {      while (length > 0x8000) {        var sublen:int = 0x8000;        // chunk can't end in high surrogate        var tail:int = buffer[offset + sublen - 1];        if (0xd800 <= tail && tail <= 0xdbff)          sublen--;        _out.writeByte('s'.charCodeAt());        _out.writeByte(sublen >> 8);        _out.writeByte(sublen);        printCharArray(buffer, offset, sublen);        length -= sublen;        offset += sublen;      }      _out.writeByte('S'.charCodeAt());      _out.writeByte(length >> 8);      _out.writeByte(length);      printCharArray(buffer, offset, length);    }    /**     * Writes a byte array to the stream.     * The array will be written with the following syntax:     *     * <p>     *   <code><pre>     *   B b16 b18 bytes     *   </pre></code>     * </p>     *     * <p>     *   If the value is null, it will be written as     *     *   <code><pre>     *   N     *   </pre></code>     * </p>     *     * @param buffer The byte buffer value to write.     * @param offset The offset in the array of where to start.     * @param length The length in the array to write.     */    public override function writeBytes(buffer:ByteArray,                                         offset:int = 0,                                         length:int = -1):void    {      if (buffer == null)        _out.writeByte('N'.charCodeAt());      else {        if (length < 0)          length = buffer.length;        while (length > 0x8000) {          var sublen:int = 0x8000;          _out.writeByte('b'.charCodeAt());          _out.writeByte(sublen >> 8);          _out.writeByte(sublen);          _out.writeBytes(buffer, offset, sublen);          length -= sublen;          offset += sublen;        }        _out.writeByte('B'.charCodeAt());        _out.writeByte(length >> 8);        _out.writeByte(length);        _out.writeBytes(buffer, offset, length);      }    }      /**     * Writes a byte buffer to the stream.     */    public override function writeByteBufferStart():void    {    }      /**     * Writes a byte buffer to the stream.     *     * <p>     *   <code><pre>     *   b b16 b18 bytes     *   </pre></code>     * </p>     *     * @param buffer The byte buffer value to write.     * @param offset The offset in the array of where to start.     * @param length The length in the array to write.     */    public override function writeByteBufferPart(buffer:ByteArray,                                                 offset:int,                                                 length:int):void    {      while (length > 0) {        var sublen:int = length;        if (0x8000 < sublen)          sublen = 0x8000;        _out.writeByte('b'.charCodeAt());        _out.writeByte(sublen >> 8);        _out.writeByte(sublen);        _out.writeBytes(buffer, offset, sublen);        length -= sublen;        offset += sublen;      }    }      /**     * Writes the last chunk of a byte buffer to the stream.     *     * <p>     *   <code><pre>     *   b b16 b18 bytes     *   </pre></code>     * </p>     *     * @param buffer The byte buffer value to write.     * @param offset The offset in the array of where to start.     * @param length The length in the array to write.     */    public override function writeByteBufferEnd(buffer:ByteArray,                                                offset:int,                                                length:int):void    {      writeBytes(buffer, offset, length);    }    /**     * Writes a reference.     *     * <p>     *   <code><pre>     *   R b32 b24 b16 b8     *   </pre></code>     * </p>     *     * @param value The integer value to write.     */    public override function writeRef(value:int):void    {      _out.writeByte('R'.charCodeAt());      _out.writeByte(value >> 24);      _out.writeByte(value >> 16);      _out.writeByte(value >> 8);      _out.writeByte(value);    }    /**     * Adds an object to the reference list.  If the object already exists,     * writes the reference, otherwise, the caller is responsible for     * the serialization.     *     * <p>     *   <code><pre>     *   R b32 b24 b16 b8     *   </pre></code>     * </p>     *     * @param object The object to add as a reference.     *     * @return true if the object has already been written.     */    public override function addRef(object:Object):Boolean    {      if (_refs == null)        _refs = new Object();      var ref:Object = _refs[object];      if (ref != null) {        var value:int = ref as int;        writeRef(value);        return true;      }      else {        _refs[object] = _numRefs++;        return false;      }    }    /**     * Resets the references for streaming.     */    public override function resetReferences():void    {      if (_refs != null) {        _refs = new Object();        _numRefs = 0;      }    }    /**     * Removes a reference.     *     * @param obj The object which has a reference.     *      * @return true if a reference was present for the given object.     */    public override function removeRef(obj:Object):Boolean    {      if (_refs != null) {        delete _refs[obj];        _numRefs--;        return true;      }      else        return false;    }    /**     * Replaces a reference from one object to another.     *      * @param oldObj The object which has a reference to replace.     * @param newObj The object to which to assign the reference.     *     * @return true if a reference was present for the given object.     */    public override function replaceRef(oldRef:Object, newRef:Object):Boolean    {      var value:Object = _refs[oldRef];      if (value != null) {        delete _refs[oldRef];        _refs[newRef] = value;        return true;      }      else        return false;    }    /**     * Prints a string to the stream, encoded as UTF-8 with preceeding length.     *     * @param value The string value to write.     * @param offset The offset in the string of where to start.     * @param length The length in the string to write.     */    public function printLenString(value:String):void    {      if (value == null) {        _out.writeByte(0);        _out.writeByte(0);      }      else {        var len:int = value.length;        _out.writeByte(len >> 8);        _out.writeByte(len);        printString(value, 0, len);      }    }    /**     * Prints a string to the stream, encoded as UTF-8.     *     * @param value The string value to write.     * @param offset The offset in the string of where to start.     * @param length The length in the string to write.     */    public function printString(value:String,                                 offset:int = 0,                                 length:int = -1):void    {      if (length < 0)        length = value.length;      for (var i:int = 0; i < length; i++) {        var ch:int = value.charCodeAt(i + offset);        if (ch < 0x80)          _out.writeByte(ch);        else if (ch < 0x800) {          _out.writeByte(0xc0 + ((ch >> 6) & 0x1f));          _out.writeByte(0x80 + (ch & 0x3f));        }        else {          _out.writeByte(0xe0 + ((ch >> 12) & 0xf));          _out.writeByte(0x80 + ((ch >> 6) & 0x3f));          _out.writeByte(0x80 + (ch & 0x3f));        }      }    }    /**     * Prints a character array to the stream, encoded as UTF-8.     *     * @param value The character array value to write.     * @param offset The offset in the string of where to start.     * @param length The length in the string to write.     */    public function printCharArray(value:Array, offset:int, length:int):void    {      for (var i:int = 0; i < length; i++) {        var ch:int = value[i + offset];        if (ch < 0x80)          _out.writeByte(ch);        else if (ch < 0x800) {          _out.writeByte(0xc0 + ((ch >> 6) & 0x1f));          _out.writeByte(0x80 + (ch & 0x3f));        }        else {          _out.writeByte(0xe0 + ((ch >> 12) & 0xf));          _out.writeByte(0x80 + ((ch >> 6) & 0x3f));          _out.writeByte(0x80 + (ch & 0x3f));        }      }    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -