-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.go
More file actions
27 lines (24 loc) · 1.13 KB
/
interfaces.go
File metadata and controls
27 lines (24 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package binutils
type untilStopByteReader interface {
// ReadBytes until the first occurrence of stopByte in the input,
// returning a slice containing the data up to and including the delimiter.
// If ReadBytes encounters an error before finding a delimiter,
// it returns the data read before the error and the error itself (often io.EOF).
// ReadBytes returns err != nil if and only if the returned data does not end in
// stopByte.
ReadBytes(stopByte byte) ([]byte, error)
}
// BinaryReaderFrom interface wraps the BinaryReadFrom method.
// Implementation method BinaryReadFrom reads implementors data from BinaryReader
// until its data restored or any error encountered.
// Returns any error encountered during reading if happened or nil.
type BinaryReaderFrom interface {
BinaryReadFrom(*BinaryReader) error
}
// BinaryWriterTo interface wraps the BinaryWriteTo method.
// Implementation method BinaryWriteTo writes implementors data into BinaryWriter
// until all marshalled or any error occurs.
// Returns any error encountered during writing if happened or nil.
type BinaryWriterTo interface {
BinaryWriteTo(*BinaryWriter) error
}