ByteInput typed interface around io.Reader or raw bytes
| 7 | |
| 8 | // ByteInput typed interface around io.Reader or raw bytes |
| 9 | type ByteInput interface { |
| 10 | // Next returns a slice containing the next n bytes from the buffer, |
| 11 | // advancing the buffer as if the bytes had been returned by Read. |
| 12 | Next(n int) ([]byte, error) |
| 13 | // NextReturnsSafeSlice returns true if Next() returns a safe slice as opposed |
| 14 | // to a slice that points to an underlying buffer possibly owned by another system. |
| 15 | // When NextReturnsSafeSlice returns false, the result from Next() should be copied |
| 16 | // before it is modified (i.e., it is immutable). |
| 17 | NextReturnsSafeSlice() bool |
| 18 | // ReadUInt32 reads uint32 with LittleEndian order |
| 19 | ReadUInt32() (uint32, error) |
| 20 | // ReadUInt16 reads uint16 with LittleEndian order |
| 21 | ReadUInt16() (uint16, error) |
| 22 | // GetReadBytes returns read bytes |
| 23 | GetReadBytes() int64 |
| 24 | // SkipBytes skips exactly n bytes |
| 25 | SkipBytes(n int) error |
| 26 | } |
| 27 | |
| 28 | // NewByteInputFromReader creates reader wrapper |
| 29 | func NewByteInputFromReader(reader io.Reader) ByteInput { |
no outgoing calls
no test coverage detected
searching dependent graphs…