// FromBinaryReader converts an OGDL binary stream of bytes into a Graph.
335950
func FromBinaryReader(r io.Reader) *Graph {
	p := newBinParser(r)
	return p.parse()
}
228916
func (m *SwaggeruserinfoResponsePayload) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
376180
func (f *File) IsBinary() (bin bool, err error) {
	reader, err := f.Reader()
	if err != nil {
		return false, err
	}
	defer ioutil.CheckClose(reader, &err)

	return binary.IsBinary(reader)
}
876906
func (h *HLL) MarshalBinary() ([]byte, error) {
	var buf bytes.Buffer
	ts := h.tempSet
	if ts == nil {
		ts = &tempSet{}
	}
	sl := h.sparseList
	if sl == nil {
		sl = &sparseList{}
	}
	err := gob.NewEncoder(&buf).Encode(
		serializable{
			P:          h.P,
			M1:         h.m1,
			M2:         h.m2,
			Alpha:      h.alpha,
			Format:     h.format,
			TempSet:    *ts,
			SparseList: *sl,
			Registers:  h.registers,
		})
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
997855
func (po *Po) MarshalBinary() ([]byte, error) {
	obj := new(TranslatorEncoding)
	obj.Headers = po.Headers
	obj.Language = po.Language
	obj.PluralForms = po.PluralForms
	obj.Nplurals = po.nplurals
	obj.Plural = po.plural
	obj.Translations = po.translations
	obj.Contexts = po.contexts

	var buff bytes.Buffer
	encoder := gob.NewEncoder(&buff)
	err := encoder.Encode(obj)

	return buff.Bytes(), err
}
595870
func (m *DaemonConfigurationSpec) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1095804
func (m *Introspection) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
816011
func (f *Frame) MarshalBinary() ([]byte, error) {
	b := make([]byte, f.length())
	_, err := f.read(b)
	return b, err
}
672604
func (b *BitSet) MarshalBinary() ([]byte, error) {
	var buf bytes.Buffer
	writer := bufio.NewWriter(&buf)

	_, err := b.WriteTo(writer)
	if err != nil {
		return []byte{}, err
	}

	err = writer.Flush()

	return buf.Bytes(), err
}
1095535
func (pl *Payload) ReadBinary(r io.Reader) error {
	dec := gob.NewDecoder(r)
	return pl.DecodeBinary(dec)
}
937376
func FromReader(rd io.Reader) (digest.Digest, error) {
	return digest.Canonical.FromReader(rd)
}
1054389
func (bh *Header) DecodeBinary(r io.Reader) error {
	var (
		lText, nRef int32
		err         error
	)
	var magic [4]byte
	err = binary.Read(r, binary.LittleEndian, &magic)
	if err != nil {
		return err
	}
	if magic != bamMagic {
		return errors.New("sam: magic number mismatch")
	}
	err = binary.Read(r, binary.LittleEndian, &lText)
	if err != nil {
		return err
	}
	if lText < 0 {
		return errors.New("sam: invalid text length")
	}
	text := make([]byte, lText)
	n, err := r.Read(text)
	if err != nil {
		return err
	}
	if n != int(lText) {
		return errors.New("sam: truncated header")
	}
	err = bh.UnmarshalText(text)
	if err != nil {
		return err
	}
	err = binary.Read(r, binary.LittleEndian, &nRef)
	if err != nil {
		return err
	}
	if nRef < 0 {
		return errors.New("sam: invalid reference count field")
	}
	refs, err := readRefRecords(r, nRef)
	if err != nil {
		return err
	}
	for _, r := range refs {
		err = bh.AddReference(r)
		if err != nil {
			return err
		}
	}
	return nil
}
1184863
func FromReader(r io.Reader) (*Model, error) {
	model := new(Model)
	d := json.NewDecoder(r)
	err := d.Decode(model)
	if err != nil {
		return nil, err
	}
	model.updateSuffixArr()
	return model, nil
}
926388
func decodeBinary(rd *bufio.Reader) (string, Binary, error) {
	// name
	name, err := readCstring(rd)
	if err != nil {
		return "", nil, err
	}

	// value
	dataLen, err := readInt32(rd)
	if err != nil {
		return "", nil, err
	}

	// discard subtype
	_, err = rd.ReadByte()
	if err != nil {
		return "", nil, err
	}
	b := make([]byte, dataLen)
	_, err = io.ReadFull(rd, b)
	if err != nil {
		return "", nil, err
	}
	return name, Binary(b), nil
}
285898
func (p *TCompactProtocol) ReadBinary() (value []byte, err error) {
	length, e := p.readVarint32()
	if e != nil {
		return []byte{}, NewTProtocolException(e)
	}
	if length == 0 {
		return []byte{}, nil
	}

	buf := make([]byte, length)
	_, e = io.ReadFull(p.trans, buf)
	return buf, NewTProtocolException(e)
}
1239720
func FromFile(s string) *Graph {
	b, err := ioutil.ReadFile(s)
	if err != nil || len(b) == 0 {
		return nil
	}

	buf := bytes.NewBuffer(b)
	p := NewParser(buf)
	p.Ogdl()
	return p.Graph()
}
1039321
func (s Slice) GetBinary() ([]byte, error) {
	if !s.IsBinary() {
		return nil, InvalidTypeError{"Expecting type Binary"}
	}

	h := s.head()
	vpackAssert(h >= 0xc0 && h <= 0xc7)

	lengthSize := uint(h - 0xbf)
	length := readIntegerNonEmpty(s[1:], lengthSize)
	checkOverflow(ValueLength(length))
	return s[1+lengthSize : 1+uint64(lengthSize)+length], nil
}