Documentation ¶
Index ¶
- func CopySeekableBody(dst io.Writer, src io.ReadSeeker) (int64, error)
- func IsReaderSeekable(r io.Reader) bool
- func SeekerLen(s io.Seeker) (int64, error)
- type MultiCloser
- type ReaderSeekerCloser
- func (r ReaderSeekerCloser) Close() error
- func (r ReaderSeekerCloser) GetLen() (int64, error)
- func (r ReaderSeekerCloser) HasLen() (int, bool)
- func (r ReaderSeekerCloser) IsSeeker() bool
- func (r ReaderSeekerCloser) Read(p []byte) (int, error)
- func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)
- type WriteAtBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopySeekableBody ¶
CopySeekableBody copies the seekable body to an io.Writer
func IsReaderSeekable ¶
IsReaderSeekable returns if the underlying reader type can be seeked. A io.Reader might not actually be seekable if it is the ReaderSeekerCloser type.
Types ¶
type MultiCloser ¶
MultiCloser is a utility to close multiple io.Closers within a single statement.
func (MultiCloser) Close ¶
func (m MultiCloser) Close() error
Close closes all of the io.Closers making up the MultiClosers. Any errors that occur while closing will be returned in the order they occur.
type ReaderSeekerCloser ¶
type ReaderSeekerCloser struct {
// contains filtered or unexported fields
}
ReaderSeekerCloser represents a reader that can also delegate io.Seeker and io.Closer interfaces to the underlying object if they are available.
func ReadSeekCloser ¶
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser
ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the SDK to accept an io.Reader that is not also an io.Seeker for unsigned streaming payload API operations.
A ReadSeekCloser wrapping an nonseekable io.Reader used in an API operation's input will prevent that operation being retried in the case of network errors, and cause operation requests to fail if the operation requires payload signing.
func (ReaderSeekerCloser) Close ¶
func (r ReaderSeekerCloser) Close() error
Close closes the ReaderSeekerCloser.
If the ReaderSeekerCloser is not an io.Closer nothing will be done.
func (ReaderSeekerCloser) GetLen ¶
func (r ReaderSeekerCloser) GetLen() (int64, error)
GetLen returns the length of the bytes remaining in the underlying reader. Checks first for Len(), then io.Seeker to determine the size of the underlying reader.
Will return -1 if the length cannot be determined.
func (ReaderSeekerCloser) HasLen ¶
func (r ReaderSeekerCloser) HasLen() (int, bool)
HasLen returns the length of the underlying reader if the value implements the Len() int method.
func (ReaderSeekerCloser) IsSeeker ¶
func (r ReaderSeekerCloser) IsSeeker() bool
IsSeeker returns if the underlying reader is also a seeker.
func (ReaderSeekerCloser) Read ¶
func (r ReaderSeekerCloser) Read(p []byte) (int, error)
Read reads from the reader up to size of p. The number of bytes read, and error if it occurred will be returned.
If the reader is not an io.Reader zero bytes read, and nil error will be returned.
Performs the same functionality as io.Reader Read
func (ReaderSeekerCloser) Seek ¶
func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)
Seek sets the offset for the next Read to 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. Seek returns the new offset and an error, if any.
If the ReaderSeekerCloser is not an io.Seeker nothing will be done.
type WriteAtBuffer ¶
type WriteAtBuffer struct { // GrowthCoeff defines the growth rate of the internal buffer. By // default, the growth rate is 1, where expanding the internal // buffer will allocate only enough capacity to fit the new expected // length. GrowthCoeff float64 // contains filtered or unexported fields }
A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface Safe to use concurrently.
func NewWriteAtBuffer ¶
func NewWriteAtBuffer(buf []byte) *WriteAtBuffer
NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer provided by buf.
func (*WriteAtBuffer) Bytes ¶
func (b *WriteAtBuffer) Bytes() []byte
Bytes returns a slice of bytes written to the buffer.
func (*WriteAtBuffer) WriteAt ¶
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error)
WriteAt writes a slice of bytes to a buffer starting at the position provided The number of bytes written will be returned, or error. Can overwrite previous written slices if the write ats overlap.