mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
28 lines
449 B
Go
28 lines
449 B
Go
package file
|
|
|
|
import "os"
|
|
|
|
// Opener opens the file in readonly mode
|
|
// caller should close afterwards
|
|
type Opener interface {
|
|
Open() (*os.File, error)
|
|
}
|
|
|
|
// Contenter reads the file content
|
|
type Contenter interface {
|
|
Content() ([]byte, error)
|
|
}
|
|
|
|
// Namer get the file name
|
|
type Namer interface {
|
|
Name() string
|
|
}
|
|
|
|
// File defines file name with its content
|
|
// file could on file system or memory
|
|
type File interface {
|
|
Opener
|
|
Contenter
|
|
Namer
|
|
}
|