代码拉取完成,页面将自动刷新
package reader
import (
"io"
"time"
"github.com/elastic/beats/filebeat/harvester/encoding"
)
// Encode reader produces lines by reading lines from an io.Reader
// through a decoder converting the reader it's encoding to utf-8.
type Encode struct {
reader *Line
}
// NewEncode creates a new Encode reader from input reader by applying
// the given codec.
func NewEncode(
reader io.Reader,
codec encoding.Encoding,
bufferSize int,
) (Encode, error) {
r, err := NewLine(reader, codec, bufferSize)
return Encode{r}, err
}
// Next reads the next line from it's initial io.Reader
// This converts a io.Reader to a reader.reader
func (p Encode) Next() (Message, error) {
c, sz, err := p.reader.Next()
// Creating message object
return Message{
Ts: time.Now(),
Content: c,
Bytes: sz,
}, err
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。