Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LimitWriter ¶
LimitWriter returns a Writer that reads from r but stops with EOF after n bytes. The underlying implementation is a *LimitedWriter.
func LimitWriterIgnoreError ¶
func LimitWriterIgnoreError(lw *LimitedWriter)
Types ¶
type LimitWriterOption ¶
type LimitWriterOption func(*LimitedWriter)
type LimitedWriter ¶
type LimitedWriter struct { W io.Writer // underlying reader N int64 // max bytes remaining MaxN int64 // max bytes remaining // contains filtered or unexported fields }
A LimitedWriter reads from R but limits the amount of data returned to just N bytes. Each call to Read updates N to reflect the new amount remaining. Read returns EOF when N <= 0 or when the underlying R returns EOF.
type PreReader ¶
type PreReader interface { io.ReadCloser Buffer() []byte String() string }
func NewPreReader ¶
func NewPreReader(reader io.ReadCloser, maxLen int) (PreReader, error)
NewPreReader
@Description[en-US]: Convert a io.ReadCloser to an io.ReadCloser that can read data in advance @Description[zh-CN]: 将一个 io.ReadCloser 转换为可预读数据的 io.ReadCloser @param reader io.ReadCloser @param maxLen int @return ${r} PreReader @return ${err} error
Click to show internal directories.
Click to hide internal directories.