コード例 #1
0
ファイル: thrift.go プロジェクト: ruflin/beats
func (thrift *thriftPlugin) readI64(data []byte) (value string, ok bool, complete bool, off int) {
	if len(data) < 8 {
		return "", true, false, 0
	}
	i64 := common.BytesNtohll(data[:8])
	value = strconv.FormatInt(int64(i64), 10)

	return value, true, true, 8
}
コード例 #2
0
ファイル: net.go プロジェクト: andrewkroh/beats
// Parse 64bit binary value from the buffer at index. Will not advance the read
// buffer
func (b *Buffer) ReadNetUint64At(index int) (uint64, error) {
	if b.Failed() {
		return 0, b.err
	}
	if !b.Avail(8 + index) {
		return 0, b.bufferEndError()
	}
	return common.BytesNtohll(b.data[index+b.mark:]), nil

}
コード例 #3
0
ファイル: net.go プロジェクト: andrewkroh/beats
// Parse 64bit binary value in network byte order from Buffer
// (converted to Host order).
func (b *Buffer) ReadNetUint64() (uint64, error) {
	if b.Failed() {
		return 0, b.err
	}
	tmp := b.data[b.mark:]
	if err := b.Advance(8); err != nil {
		return 0, err
	}
	value := common.BytesNtohll(tmp)
	return value, nil
}