gf/internal/fileinfo/fileinfo.go

54 lines
951 B
Go
Raw Normal View History

2021-01-17 21:46:25 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// Package fileinfo provides virtual os.FileInfo for given information.
package fileinfo
import (
"os"
"time"
)
type Info struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func New(name string, size int64, mode os.FileMode, modTime time.Time) *Info {
return &Info{
name: name,
size: size,
mode: mode,
modTime: modTime,
}
}
func (i *Info) Name() string {
return i.name
}
func (i *Info) Size() int64 {
return i.size
}
func (i *Info) IsDir() bool {
return i.mode.IsDir()
}
func (i *Info) Mode() os.FileMode {
return i.mode
}
func (i *Info) ModTime() time.Time {
return i.modTime
}
func (i *Info) Sys() interface{} {
return nil
}