deserialize the data to header.
 this does not contain total byte number.
 @param [String] data
 @return [Header] self
541294
def deserialize(data)
      while data.length > 0
        len, data = data.unpack('Va*')
        msg = data[0..(len-1)]
        equal_position = msg.index('=')
        key = msg[0..(equal_position-1)]
        value = msg[(equal_position+1)..-1]
        @data[key] = value
        data = data[(len)..-1]
      end
      self
    end
475119
def write(data)
      return nil if data.nil?
      @slicebuf ||= ""
      @inputproxy ||= StringIO.new
      @inputproxy.string = String(data)
      until @inputproxy.eof?
        slicesize = @blocksize - @buf.bytesize
        slicesize = @blocksize if slicesize > @blocksize
        @buf << @inputproxy.read(slicesize, @slicebuf)
        export_block if @buf.bytesize >= @blocksize
      end

      self
    end
1023165
private int parseHeader(byte[] data) throws DataFormatException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Parsing gzip header; state=" + this.state);
        }
        int pos = 0;
        for (; pos < data.length && PARSE_STATE.DONE != this.state;) {
            byte b = data[pos++];
            if (PARSE_STATE.ID1 == this.state) {
                if ((byte) 0x1F != b) {
                    throw new DataFormatException("Invalid gzip header, first byte=" + b);
                }
                this.state = PARSE_STATE.ID2;
            } else if (PARSE_STATE.ID2 == this.state) {
                if ((byte) 0x8B != b) {
                    throw new DataFormatException("Invalid gzip header, second byte=" + b);
                }
                this.state = PARSE_STATE.COMPRESSION;
            } else if (PARSE_STATE.COMPRESSION == this.state) {
                if (Deflater.DEFLATED != b) {
                    throw new DataFormatException("Invalid gzip compression method=" + b);
                }
                this.state = PARSE_STATE.FLAG;
            } else if (PARSE_STATE.FLAG == this.state) {
                if (-1 == this.gzipFlag) {
                    // after saving the extra flag byte, skip the next 6 bytes
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "gzip header flag=" + b);
                    }
                    this.gzipFlag = b;
                    pos = skip(data, pos, 6);
                } else {
                    // previously saw the flag but didn't skip a full 6
                    pos = skip(data, pos, this.parseInt);
                }
                if (0 == this.parseInt) {
                    if (isFExtraSet()) {
                        this.state = PARSE_STATE.FEXTRA;
                    } else if (isFNameSet()) {
                        this.state = PARSE_STATE.FNAME;
                    } else if (isFCommentSet()) {
                        this.state = PARSE_STATE.FCOMMENT;
                    } else if (isFHCRCSet()) {
                        this.state = PARSE_STATE.FHCRC;
                    } else {
                        this.state = PARSE_STATE.DONE;
                    }
                    this.parseOffset = 0;
                }
            } else if (PARSE_STATE.FEXTRA == this.state) {
                // FEXTRA has length in 2 bytes, then that many bytes
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Parsing FEXTRA data, offset=" + this.parseOffset);
                }
                if (0 == this.parseOffset) {
                    this.parseInt = b;
                    this.parseOffset++;
                    continue;
                } else if (1 == this.parseOffset) {
                    this.parseInt = (b << 8) | this.parseInt;
                    this.parseOffset++;
                }
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "FEXTRA length is " + this.parseInt);
                }
                pos = skip(data, pos, this.parseInt);
                if (0 == this.parseInt) {
                    if (isFNameSet()) {
                        this.state = PARSE_STATE.FNAME;
                    } else if (isFCommentSet()) {
                        this.state = PARSE_STATE.FCOMMENT;
                    } else if (isFHCRCSet()) {
                        this.state = PARSE_STATE.FHCRC;
                    } else {
                        this.state = PARSE_STATE.DONE;
                    }
                    this.parseOffset = 0;
                }
            } else if (PARSE_STATE.FNAME == this.state) {
                // FNAME is a zero delimited file name
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Parsing FNAME data");
                }
                if (0 != b) {
                    pos = skipPast(data, pos, (byte) 0);
                }
                if (data.length == pos) {
                    return pos;
                }
                if (isFCommentSet()) {
                    this.state = PARSE_STATE.FCOMMENT;
                } else if (isFHCRCSet()) {
                    this.state = PARSE_STATE.FHCRC;
                } else {
                    this.state = PARSE_STATE.DONE;
                }
            } else if (PARSE_STATE.FCOMMENT == this.state) {
                // FCOMMENT is a zero delimited file comment
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Parsing FCOMMENT data");
                }
                if (0 != b) {
                    pos = skipPast(data, pos, (byte) 0);
                }
                if (data.length == pos) {
                    return pos;
                }
                if (isFHCRCSet()) {
                    this.state = PARSE_STATE.FHCRC;
                } else {
                    this.state = PARSE_STATE.DONE;
                }
            } else if (PARSE_STATE.FHCRC == this.state) {
                // FHCRC has 2 extra bytes (checksum of all gzip header bytes)
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Parsing FHCRC data; offset=" + this.parseOffset);
                }
                this.parseOffset++;
                if (2 > this.parseOffset) {
                    continue;
                }
                this.state = PARSE_STATE.DONE;
            }
        } // end loop

        if (PARSE_STATE.DONE == this.state) {
            this.parseOffset = 0;
            this.parseInt = 0;
        }
        return pos;
    }
828507
def receive_data(data)
      @data << data

      return unless data.index("\n\n")
      begin
        result = _receive_data(@data)
      rescue
        raise
        result = nil
      end
      @callback.call(!result.nil?, result) unless @callback.nil?
      @callback = nil
      @available = true
    end
869667
def convert(data, first)
      output = data.map(&:to_json).join(',')
      first ? output : ',' + output
    end
551712
def parse_headers(header_data_for_multiple_responses)
      @headers = {}

      responses = Patron::HeaderParser.parse(header_data_for_multiple_responses)
      last_response = responses[-1] # Only use the last response (for proxies and redirects)

      @status_line = last_response.status_line
      last_response.headers.each do |line|
        hdr, val = line.split(":", 2)

        val.strip! unless val.nil?

        if @headers.key?(hdr)
          @headers[hdr] = [@headers[hdr]] unless @headers[hdr].kind_of? Array
          @headers[hdr] << val
        else
          @headers[hdr] = val
        end
      end
    end
738265
def parse(data)
      if !data.respond_to?(:read)
        data = StringIO.new(data || "")
      end

      if data.eof?
        {}
      else
        LibXML::XML::Parser.io(data).parse.to_hash
      end
    end
229167
def decrypt(self, data):
        
        if False in six.itervalues(self.ready):
            raise CipherError(data)
        decryptor = self._cipher.decryptor()
        tmp = decryptor.update(data) + decryptor.finalize()
        self.iv = data[-self.block_size:]
        return tmp
973564
def _to_bytes(self, data):
        
        # TODO: On Python 3, move this `if` line to the `except` branch
        # as the common case will indeed no longer be bytes.
        if not isinstance(data, bytes):
            try:
                return data.encode('utf-8')
            except Exception:
                return None

        return data
795719
@SuppressWarnings("unchecked")
    public static <T> T deserialize(final byte[] data) {
        if (data == null) {
            return null;
        }
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
            final ObjectInputStream in = new ObjectInputStream(bais);
            return (T) in.readObject();
        } catch (final ClassNotFoundException ex) {
            throw new RuntimeException(ex);
        } catch (final IOException ex) {
            throw new RuntimeException(ex);
        }
    }
1346916
def unpack(data):
        
        length = struct.unpack('i', data[0:HEADER_SIZE])
        return length[0], data[HEADER_SIZE:]
1094702
def parse(self, data):
        
        self._data = data = data if isinstance(data, SWFStream) else SWFStream(data)
        self._header = SWFHeader(self._data)
        if self._header.compressed:
            temp = BytesIO()
            if self._header.compressed_zlib:
                import zlib
                data = data.f.read()
                zip = zlib.decompressobj()
                temp.write(zip.decompress(data))
            else:
                import pylzma
                data.readUI32() #consume compressed length
                data = data.f.read()
                temp.write(pylzma.decompress(data))
            temp.seek(0)
            data = SWFStream(temp)
        self._header._frame_size = data.readRECT()
        self._header._frame_rate = data.readFIXED8()
        self._header._frame_count = data.readUI16()
        self.parse_tags(data)
540293
def to_xml(data)
      ox = XML::Node.new(ox_tag)
      wrappers = {}
      
      ox_elems.each do |elem|
        if elem.in
          wrappers[elem.in] ||= XML::Node.new elem.in
          elem.to_xml(data).each {|e| wrappers[elem.in] << e}
        else
          elem.to_xml(data).each {|e| ox << e}
        end
      end
      
      wrappers.each {|k,v| ox << v}
      
      ox_attrs.each do |a| 
        val = data.send(a.accessor).to_s
        ox[a.tag]= val if val.present?
      end
      
      ox
    end
600675
def from_data(cls, data):
        
        obj = cls()
        with contextlib.closing(BytesIO(data)) as file_handle:
            obj.load_file(file_handle)
        return obj
28805
def data_to_bytes(self, data_element, encoding=None):
        
        if encoding is None:
            encoding = self.encoding
        text = self.data_to_string(data_element)
        return bytes_(text, encoding=encoding)
721425
def data
      @data ||= begin
        list = @xml.find('/e:epp/e:response/e:resData/node()').reject { |n| n.empty? }
        list.size > 1 ? list : list[0]
      end
    end
709561
def _wrap_data(data: Union[str, bytes]):
        
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        return MsgType(data=data, frame_finished=True, message_finished=True)