Documentation
¶
Overview ¶
Package io contains generated code by adptool.
Package io provides I/O utility functions, extending the standard io package.
Index ¶
- Constants
- Variables
- func Copy(ctx context.Context, dst io.Writer, src io.Reader) (int64, error)
- func Delete(path string) error
- func Exists(path string) (bool, error)
- func ReadToBuffer(path string, buf *bytes.Buffer) (int64, error)
- func Save(ctx context.Context, dstPath string, src io.Reader) (int64, error)
- func StdCopy(dst io.Writer, src io.Reader) (written int64, err error)
- func StdCopyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error)
- func StdCopyN(dst io.Writer, src io.Reader, n int64) (written int64, err error)
- func StdLimitReader(r io.Reader, n int64) io.Reader
- func StdMultiReader(readers ...io.Reader) io.Reader
- func StdMultiWriter(writers ...io.Writer) io.Writer
- func StdNewOffsetWriter(w io.WriterAt, off int64) *io.OffsetWriter
- func StdNewSectionReader(r io.ReaderAt, off int64, n int64) *io.SectionReader
- func StdNopCloser(r io.Reader) io.ReadCloser
- func StdPipe() (*io.PipeReader, *io.PipeWriter)
- func StdReadAll(r io.Reader) ([]byte, error)
- func StdReadAtLeast(r io.Reader, buf []byte, min int) (n int, err error)
- func StdReadFull(r io.Reader, buf []byte) (n int, err error)
- func StdTeeReader(r io.Reader, w io.Writer) io.Reader
- func StdWriteString(w io.Writer, s string) (n int, err error)
- func Stream(ctx context.Context, srcPath string, dst io.Writer) (int64, error)
- type ByteReader
- type ByteScanner
- type ByteWriter
- type Closer
- type DirEntry
- type FileInfo
- type LimitedReader
- type OffsetWriter
- type PipeReader
- type PipeWriter
- type ReadCloser
- type ReadDirFile
- type ReadSeekCloser
- type ReadSeeker
- type ReadWriteCloser
- type ReadWriteSeeker
- type ReadWriter
- type Reader
- type ReaderAt
- type ReaderFrom
- type RuneReader
- type RuneScanner
- type SectionReader
- type Seeker
- type StringWriter
- type WriteCloser
- type WriteSeeker
- type Writer
- type WriterAt
- type WriterTo
Constants ¶
const ( SeekCurrent = io.SeekCurrent SeekEnd = io.SeekEnd SeekStart = io.SeekStart )
Variables ¶
var ( Discard = io.Discard EOF = io.EOF ErrClosedPipe = io.ErrClosedPipe ErrNoProgress = io.ErrNoProgress ErrShortBuffer = io.ErrShortBuffer ErrShortWrite = io.ErrShortWrite ErrUnexpectedEOF = io.ErrUnexpectedEOF )
var ( // ErrZeroSize indicates that a file's size is zero. ErrZeroSize = errors.New("file Size is zero") // ErrUnsupportedType indicates that a file's type is not supported. ErrUnsupportedType = errors.New("file type is not supported") // ErrTargetIsNotDir indicates that a target path for an operation is not a directory. ErrTargetIsNotDir = errors.New("target is not a directory") // ErrRead indicates a failure to read from a file. ErrRead = errors.New("file read error") // ErrWrite indicates a failure to write to a file. ErrWrite = errors.New("file write error") // ErrNotExist indicates that a file or directory does not exist. ErrNotExist = errors.New("file not exist") // ErrEmptyPath indicates that a file path is empty. ErrEmptyPath = errors.New("file path is empty") // ErrSizeNotMatch indicates that the number of bytes written does not match the expected size. ErrSizeNotMatch = errors.New("file size not match") )
Errors returned by this package.
Functions ¶
func Copy ¶ added in v1.1.0
Copy copies data from src to dst until EOF, context cancellation, or an error occurs. It returns the number of bytes copied.
func Delete ¶ added in v1.1.0
Delete removes the file at the specified path. If the path is empty, it returns ErrEmptyPath. If the file does not exist, it returns no error.
func Exists ¶ added in v1.1.0
Exists checks if a file or directory exists at the given path. It returns true if the path exists, and false if it does not. An error is returned only if the check itself fails due to permission issues or other system errors.
func ReadToBuffer ¶ added in v1.1.0
ReadToBuffer reads the entire file at the given path into the provided buffer.
func Save ¶ added in v1.1.0
Save reads all data from a reader and saves it to the specified destination path. It automatically creates any necessary parent directories for the destination path.
func StdCopyBuffer ¶
func StdNewOffsetWriter ¶ added in v1.1.0
func StdNewOffsetWriter(w io.WriterAt, off int64) *io.OffsetWriter
func StdNewSectionReader ¶ added in v1.1.0
func StdNopCloser ¶
func StdNopCloser(r io.Reader) io.ReadCloser
func StdPipe ¶
func StdPipe() (*io.PipeReader, *io.PipeWriter)
Types ¶
type ByteReader ¶
type ByteReader = io.ByteReader
type ByteScanner ¶
type ByteScanner = io.ByteScanner
type ByteWriter ¶
type ByteWriter = io.ByteWriter
type LimitedReader ¶ added in v1.1.0
type LimitedReader = io.LimitedReader
type OffsetWriter ¶
type OffsetWriter = io.OffsetWriter
type PipeReader ¶ added in v1.1.0
type PipeReader = io.PipeReader
type PipeWriter ¶ added in v1.1.0
type PipeWriter = io.PipeWriter
type ReadCloser ¶
type ReadCloser = io.ReadCloser
type ReadSeekCloser ¶
type ReadSeekCloser = io.ReadSeekCloser
type ReadSeeker ¶
type ReadSeeker = io.ReadSeeker
type ReadWriteCloser ¶
type ReadWriteCloser = io.ReadWriteCloser
type ReadWriteSeeker ¶
type ReadWriteSeeker = io.ReadWriteSeeker
type ReadWriter ¶ added in v1.1.0
type ReadWriter = io.ReadWriter
type ReaderFrom ¶
type ReaderFrom = io.ReaderFrom
type RuneReader ¶
type RuneReader = io.RuneReader
type RuneScanner ¶
type RuneScanner = io.RuneScanner
type SectionReader ¶
type SectionReader = io.SectionReader
type StringWriter ¶ added in v0.3.13
type StringWriter = io.StringWriter
type WriteCloser ¶
type WriteCloser = io.WriteCloser
type WriteSeeker ¶ added in v1.1.0
type WriteSeeker = io.WriteSeeker