Documentation ¶
Index ¶
- type File
- func (fb *File) Bytes() []byte
- func (fb *File) Close() error
- func (fb *File) Read(b []byte) (int, error)
- func (fb *File) ReadAt(b []byte, offset int64) (int, error)
- func (fb *File) Seek(offset int64, whence int) (int64, error)
- func (fb *File) Truncate(n int64) error
- func (fb *File) Write(b []byte) (int, error)
- func (fb *File) WriteAt(b []byte, offset int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is an in-memory emulation of the I/O operations of os.File. The zero value for File is an empty file ready to use.
func New ¶
New creates and initializes a new File using b as its initial contents. The new File takes ownership of b.
func (*File) Bytes ¶
Bytes returns the full contents of the File. The result in only valid until the next Write, WriteAt, or Truncate call.
func (*File) Read ¶
Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns (0, io.EOF).
func (*File) ReadAt ¶
ReadAt reads len(b) bytes from the File starting at byte offset. It returns the number of bytes read and the error, if any. At end of file, that error is io.EOF.
func (*File) Seek ¶
Seek sets the offset for the next Read or Write on file with offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end.
func (*File) Write ¶
Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. If the current file offset is past the io.EOF, then the space in-between are implicitly filled with zero bytes.