-
Notifications
You must be signed in to change notification settings - Fork 7
/
View.go
29 lines (22 loc) · 855 Bytes
/
View.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package resource
import (
"io"
)
// View is a read-only view on a selected resource.
type View interface {
// Compound tells whether the resource should be serialized with a directory.
// Compound resources can have zero, one, or more blocks.
// Simple resources always have exactly one block.
Compound() bool
// ContentType describes how the block data shall be interpreted.
ContentType() ContentType
// Compressed tells whether the data shall be serialized in compressed form.
Compressed() bool
// BlockCount returns the number of available blocks in the resource.
// Simple resources will always have exactly one block.
BlockCount() int
// Block returns the reader for the identified block.
// Each call returns a new reader instance.
// Data provided by this reader is always uncompressed.
Block(index int) (io.Reader, error)
}