Struct: aws.ReaderSeekerCloser

import "../ibm-cos-sdk-go/aws"

Overview

ReaderSeekerCloser represents a reader that can also delegate io.Seeker and io.Closer interfaces to the underlying object if they are available.

Implemented Interfaces

s3crypto.Cipher, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Method Summary collapse

Method Details

func (r ReaderSeekerCloser) Close() error

Close closes the ReaderSeekerCloser.

If the ReaderSeekerCloser is not an io.Closer nothing will be done.



151
152
153
154
155
156
157
// File 'aws/types.go', line 151

func (r ReaderSeekerCloser) Close() error { switch t := r.r.(type) { case io.Closer: return t.Close() } return nil }

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.



102
103
104
105
106
107
108
109
110
111
112
// File 'aws/types.go', line 102

func (r ReaderSeekerCloser) GetLen() (int64, error) { if l, ok := r.HasLen(); ok { return int64(l), nil } if s, ok := r.r.(io.Seeker); ok { return seekerLen(s) } return -1, nil }

func (r ReaderSeekerCloser) HasLen() (int, bool)

HasLen returns the length of the underlying reader if the value implements the Len() int method.



85
86
87
88
89
90
91
92
93
94
95
// File 'aws/types.go', line 85

func (r ReaderSeekerCloser) HasLen() (int, bool) { type lenner interface { Len() int } if lr, ok := r.r.(lenner); ok { return lr.Len(), true } return 0, false }

func (r ReaderSeekerCloser) IsSeeker() bool

IsSeeker returns if the underlying reader is also a seeker.



78
79
80
81
// File 'aws/types.go', line 78

func (r ReaderSeekerCloser) IsSeeker() bool { _, ok := r.r.(io.Seeker) return ok }

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



55
56
57
58
59
60
61
// File 'aws/types.go', line 55

func (r ReaderSeekerCloser) Read(p []byte) (int, error) { switch t := r.r.(type) { case io.Reader: return t.Read(p) } return 0, nil }

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.



69
70
71
72
73
74
75
// File 'aws/types.go', line 69

func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { switch t := r.r.(type) { case io.Seeker: return t.Seek(offset, whence) } return int64(0), nil }