Decode a file or stream to an object.
348940
def bread(stream):
    
    if hasattr(stream, "read"):
        return bdecode(stream.read())
    else:
        handle = open(stream, "rb")
        try:
            return bdecode(handle.read())
        finally:
            handle.close()
699413
def stream_decode_response_unicode(iterator, r):
    """"""
    encoding = get_encoding_from_headers(r.headers)
    if encoding is None:
        for item in iterator:
            yield item
        return

    decoder = codecs.getincrementaldecoder(encoding)(errors='replace')
    for chunk in iterator:
        rv = decoder.decode(chunk)
        if rv:
            yield rv
    rv = decoder.decode('', final=True)
    if rv:
        yield rv
600120
def _decode(self, obj, context):
        
        cls = self._get_class(obj.classID)
        return cls.from_construct(obj, context)
449610
def parse_file(self, filename, encoding=None, debug=False):
        """"""
        stream = codecs.open(filename, "r", encoding)
        try:
            return self.parse_stream(stream, debug)
        finally:
            stream.close()
1087923
def create_from_file(cls, filename):
        """"""
        obj = cls()
        obj.object_file = filename
        obj.load()
        return obj
1144330
function Decoder(conf, options, file) {
  Transform.call(this);

  this._writableState.objectMode = true;
  this._readableState.objectMode = true;

  this.eol = options.eol;
  this.conf = conf;
  this.file = file;
  this.lineNumber = 0;
}
856313
function decode(object) {
        if (defaults.decodeBase64 && object && object.content > '' &&
            object.encoding && object.encoding === 'base64') {
            object.content = b64decode(object.content)
        }
        return object
    }
418033
def from_blob(cls, blob):
        
        stream = BytesIO(blob)
        return cls._from_stream(stream, blob)
1107657
def decode(self, byteStream):
        """"""
        self.header = bytearray(byteStream[:HEADER_SIZE])
        self.payload = byteStream[HEADER_SIZE:]
63538
def read(cls, filename, offset=None, encoding="iso-8859-1"):
        """"""
        with fileutil.opened(filename, "rb") as file:
            if offset is None:
                file.seek(-128, 2)
            else:
                file.seek(offset)
            data = file.read(128)
            return cls.decode(data, encoding=encoding)
1143532
def dumpf(obj, path, encoding=None):
    """"""
    path = str(path)
    if path.endswith('.gz'):
        with gzip.open(path, mode='wt', encoding=encoding) as f:
            return dump(obj, f)
    else:
        with open(path, mode='wt', encoding=encoding) as f:
            dump(obj, f)
1092525
def decode(in_bytes):
    """"""
    if isinstance(in_bytes, str):
        raise TypeError('Unicode-objects are not supported; byte buffer objects only')
    in_bytes_mv = _get_buffer_view(in_bytes)
    out_bytes = bytearray()
    idx = 0

    if len(in_bytes_mv) > 0:
        while True:
            length = ord(in_bytes_mv[idx])
            if length == 0:
                raise DecodeError("zero byte found in input")
            idx += 1
            end = idx + length - 1
            copy_mv = in_bytes_mv[idx:end]
            if b'\x00' in copy_mv:
                raise DecodeError("zero byte found in input")
            out_bytes += copy_mv
            idx = end
            if idx > len(in_bytes_mv):
                raise DecodeError("not enough input bytes for length code")
            if idx < len(in_bytes_mv):
                if length < 0xFF:
                    out_bytes.append(0)
            else:
                break
    return bytes(out_bytes)
257685
function decode(data) {
  return io.tmpFile().then(function(file) {
    var buf = new Buffer(data, 'base64');
    return promise.checkedNodeCall(fs.writeFile, file, buf).then(function() {
      return io.tmpDir();
    }).then(function(dir) {
      var zip = new AdmZip(file);
      zip.extractAllTo(dir);  // Sync only? Why?? :-(
      return dir;
    });
  });
}
1149426
private InputStream decodeStream(String encoding, InputStream initialStream)
			throws IOException {
		if (encoding == null)
			return initialStream;
		if ("gzip".equals(encoding))
			return new GZIPInputStream(initialStream);
		if ("deflate".equals(encoding))
			return new InflaterInputStream(initialStream);
		throw new IOException("Unsupported transport encoding " + encoding);
	}
126798
def decode_streaming(self, data):
        
        # Reverse lookup table: map (bitsize, value) to symbols
        lookup = dict(((b, v), s) for (s, (b, v)) in self._table.items())

        buffer = 0
        size = 0
        for byte in data:
            for m in [128, 64, 32, 16, 8, 4, 2, 1]:
                buffer = (buffer << 1) + bool(from_byte(byte) & m)
                size += 1
                if (size, buffer) in lookup:
                    symbol = lookup[size, buffer]
                    if symbol == _EOF:
                        return
                    yield symbol
                    buffer = 0
                    size = 0
1227227
public static Object convertInputStreamToObject(InputStream is) throws IOException, ClassNotFoundException{
		ObjectInputStream ois = new ObjectInputStream(is);
		return ois.readObject();
	}
1019432
def from_stream(cls, f, **kwargs):
        """"""
        lines = lines_from_stream(f)
        if 'meta' not in kwargs:
            kwargs['meta'] = {'from': 'stream'}
        kwargs['meta']['filepath'] = f.name if hasattr(f, 'name') else None
        return cls(lines, **kwargs)