Deserialize UInt32 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value:number|UInt32}} anchor: byteOffset
@private
345393
function __deserializeUInt32(buffer, start, options) {
	let end = start + 4;
	let dataView = new DataView(buffer);
	let data = dataView.getUint32(start, true);
	return { anchor: end, value:options.use_native_types ? data : UInt32.from(data) };
}
7067
function deserializeInnerMessage(spec, message, buffer, bufferOffset) {
  spec.fields.forEach(function(field) {
    var fieldValue = message[field.name];

    if (field.isArray) {
      var array     = [];
      var arrayType = field.baseType;

      var arraySize;
      if (field.arrayLen !== null) {
        arraySize = field.arrayLen;
      } else {
        arraySize = buffer.readUInt32LE(bufferOffset[0]);
        bufferOffset[0] += 4; // only for variable length arrays
      }

      let ArrayMsgClass;
      let isPrimitive = field.isBuiltin;
      if (!isPrimitive) {
        ArrayMsgClass = getMessageFromRegistry(arrayType, 'msg');
      }

      for (var i = 0; i < arraySize; i++) {
        if (isPrimitive) {
          var value = fieldsUtil.deserializePrimitive(
            arrayType, buffer, bufferOffset);
          array.push(value);
        }
        else { // is message
          var arrayMessage = new ArrayMsgClass();

          arrayMessage = deserializeInnerMessage(spec.getMsgSpecForType(arrayType),
            arrayMessage, buffer, bufferOffset);

          array.push(arrayMessage);
        }
      }
      fieldValue = array;
    }
    else if (field.isBuiltin) {
      fieldValue = fieldsUtil.deserializePrimitive(
        field.type, buffer, bufferOffset)
    }
    else { // is message
      var innerMessage = new getMessageFromRegistry(field.baseType, 'msg')();
      fieldValue = deserializeInnerMessage(spec.getMsgSpecForType(field.baseType),
        innerMessage, buffer, bufferOffset);
    }

    message[field.name] = fieldValue;
  });

  return message;
}
196755
function EUCJPDecoder(options) {
  var fatal = options.fatal;
  var /** @type {number} */ eucjp_first = 0x00,
      /** @type {number} */ eucjp_second = 0x00;
  /**
   * @param {ByteInputStream} byte_pointer The byte stream to decode.
   * @return {?number} The next code point decoded, or null if not enough
   *     data exists in the input stream to decode a complete code point.
   */
  this.decode = function(byte_pointer) {
    var bite = byte_pointer.get();
    if (bite === EOF_byte) {
      if (eucjp_first === 0x00 && eucjp_second === 0x00) {
        return EOF_code_point;
      }
      eucjp_first = 0x00;
      eucjp_second = 0x00;
      return decoderError(fatal);
    }
    byte_pointer.offset(1);

    var lead, code_point;
    if (eucjp_second !== 0x00) {
      lead = eucjp_second;
      eucjp_second = 0x00;
      code_point = null;
      if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
        code_point = indexCodePointFor((lead - 0xA1) * 94 + bite - 0xA1,
                                       indexes['jis0212']);
      }
      if (!inRange(bite, 0xA1, 0xFE)) {
        byte_pointer.offset(-1);
      }
      if (code_point === null) {
        return decoderError(fatal);
      }
      return code_point;
    }
    if (eucjp_first === 0x8E && inRange(bite, 0xA1, 0xDF)) {
      eucjp_first = 0x00;
      return 0xFF61 + bite - 0xA1;
    }
    if (eucjp_first === 0x8F && inRange(bite, 0xA1, 0xFE)) {
      eucjp_first = 0x00;
      eucjp_second = bite;
      return null;
    }
    if (eucjp_first !== 0x00) {
      lead = eucjp_first;
      eucjp_first = 0x00;
      code_point = null;
      if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
        code_point = indexCodePointFor((lead - 0xA1) * 94 + bite - 0xA1,
                                       indexes['jis0208']);
      }
      if (!inRange(bite, 0xA1, 0xFE)) {
        byte_pointer.offset(-1);
      }
      if (code_point === null) {
        return decoderError(fatal);
      }
      return code_point;
    }
    if (inRange(bite, 0x00, 0x7F)) {
      return bite;
    }
    if (bite === 0x8E || bite === 0x8F || (inRange(bite, 0xA1, 0xFE))) {
      eucjp_first = bite;
      return null;
    }
    return decoderError(fatal);
  };
}
145135
public static byte[] getBytes(ByteBuf buf, int start, int length) {
        return getBytes(buf, start, length, true);
    }
619811
function readUInt64BE(buffer, start) {
  var data = buffer.slice(start, start + 8);
  return data.readUInt32BE(4, 8);
}
533664
function __deserializeFloat64(buffer, start, options) {
	let end = start + 8;
	let dataView = new DataView(buffer);
	let data = dataView.getFloat64(start, true);
	return { anchor: end, value: data };
}
420619
function XUserDefinedEncoder(options) {
    var fatal = options.fatal;
    /**
     * @param {Stream} stream Input stream.
     * @param {number} code_point Next code point read from the stream.
     * @return {(number|!Array.<number>)} Byte(s) to emit.
     */
    this.handler = function(stream, code_point) {
      // 1.If code point is end-of-stream, return finished.
      if (code_point === end_of_stream)
        return finished;

      // 2. If code point is an ASCII code point, return a byte whose
      // value is code point.
      if (isASCIICodePoint(code_point))
        return code_point;

      // 3. If code point is in the range U+F780 to U+F7FF, return a
      // byte whose value is code point − 0xF780 + 0x80.
      if (inRange(code_point, 0xF780, 0xF7FF))
        return code_point - 0xF780 + 0x80;

      // 4. Return error with code point.
      return encoderError(code_point);
    };
  }
1240205
function parseSimpleString (parser) {
  const start = parser.offset
  const buffer = parser.buffer
  const length = buffer.length - 1
  var offset = start

  while (offset < length) {
    if (buffer[offset++] === 13) { // \r\n
      parser.offset = offset + 1
      if (parser.optionReturnBuffers === true) {
        return parser.buffer.slice(start, offset - 1)
      }
      return parser.buffer.toString('utf8', start, offset - 1)
    }
  }
}
96624
function __deserializeUInt8(buffer, start, options) {
	let end = start + 1;
	let dataView = new DataView(buffer);
	let data = dataView.getUint8(start);
	return { anchor: end, value:options.use_native_types ? data : UInt8.from(data) };
}
1110012
function __serializeObject(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
	// ignore undefined value
	for (let key of allKeys) {
		let subData = data[key];
		if (subData === undefined) continue;

		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let keyBuffers = __serializeShortString(key);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...keyBuffers, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
313909
function (start, end) {
    var offsetStart;
    var offsetEnd;

    loadBufferIfRequired(start, end);

    offsetStart = start - currentRange.start;
    offsetEnd = offsetStart + (end - start);

    return buffer.slice(offsetStart, offsetEnd);
  }
1075290
function __serializeArrayStreaming(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	// ignore undefined value
	for (let key in data) {
		let subData = data[key];
		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...subDataBuffers);
	}
	return [...dataBuffers, TYPE_HEADER.ARRAY_END];
}
1126464
private long read32(byte[] buffer, int offset) {
        byte b0 = buffer[offset];
        byte b1 = buffer[offset + 1];
        byte b2 = buffer[offset + 2];
        byte b3 = buffer[offset + 3];

        // convert signed bytes to unsigned values
        int i0 = ((b0 & 0x80) == 0x80 ? (b0 & 0x7F) + 0x80 : b0);
        int i1 = ((b1 & 0x80) == 0x80 ? (b1 & 0x7F) + 0x80 : b1);
        int i2 = ((b2 & 0x80) == 0x80 ? (b2 & 0x7F) + 0x80 : b2);
        int i3 = ((b3 & 0x80) == 0x80 ? (b3 & 0x7F) + 0x80 : b3);

        return ((long) i0 << 24) + ((long) i1 << 16) + ((long) i2 << 8) + (long) i3;
    }
355981
function dataURItoBuffer(dataURI){
    var byteString = atob(dataURI.split(',')[1]);
    var buffer = new ArrayBuffer(byteString.length);
    var view = new Uint8Array(buffer);
    for (var i = 0; i < byteString.length; i++) {
        view[i] = byteString.charCodeAt(i);
    }
    return buffer;
}
1225565
function serialize(type, source, options) {
  var codec = type.codec
  if (!codec)
    return postEncode(new Buffer([ type.byte ]), options)

  var buffer = codec.encode(source, bytewise)

  if (options && options.nested && codec.escape)
    buffer = codec.escape(buffer)

  var hint = typeof codec.length === 'number' ? (codec.length + 1) : void 0 
  var buffers = [ new Buffer([ type.byte ]), buffer ]
  return postEncode(Buffer.concat(buffers, hint), options)
}
683228
function __serializeContent(data, options=DEFAULT_OPTIONS) {
	let type = __getType(data, options);
	let typeBuffer	= __serializeType(type, options);
	let dataBuffers = __serializeData(type, data, options);
	return [typeBuffer, ...dataBuffers];
}
676965
function __deserializeArrayStreaming(buffer, start, options) {
	let end = start;
	let dataView = new DataView(buffer);
	let endData = new Uint16Array(TYPE_HEADER.ARRAY_END);
	let data = [];
	while (start < buffer.byteLength) {
		let tmpType = dataView.getUint16(start, true);
		if (tmpType === endData[0]) {
			end += 2;
			break;
		}
		
		let subType, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data.push(subData);
		end = start;
	}
	return { anchor: end, value: data };
}