hex-convert/gen/assets_vfsdata.go

185 lines
6.1 KiB
Go
Raw Normal View History

2018-08-01 03:18:23 +00:00
// Code generated by vfsgen; DO NOT EDIT.
package gen
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
pathpkg "path"
"time"
)
// Assets statically implements the virtual filesystem provided to vfsgen.
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{
"/": &vfsgen۰DirInfo{
name: "/",
2019-09-19 08:45:45 +00:00
modTime: time.Date(2019, 9, 19, 8, 41, 27, 36642564, time.UTC),
2018-08-01 03:18:23 +00:00
},
"/index.tpl": &vfsgen۰CompressedFileInfo{
name: "index.tpl",
2019-09-19 08:45:45 +00:00
modTime: time.Date(2019, 9, 19, 8, 41, 27, 35059012, time.UTC),
uncompressedSize: 434,
2018-08-01 03:18:23 +00:00
2019-09-19 08:45:45 +00:00
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\xd1\xb1\x4a\xc5\x30\x14\x06\xe0\xd9\x3e\x45\x38\x2f\x10\xeb\x20\x0e\xc9\x79\x97\xd8\x1e\x69\x21\x6d\xc2\xcd\xa9\xe8\xa6\x60\xc1\xc1\x3b\x89\x8b\x6e\x82\x93\x8a\x4e\x0a\xa2\xd7\x97\x31\xd7\x3e\x86\xd4\x58\x70\x50\xf1\x66\x4c\xf8\xf2\x1f\xfe\xa3\xaa\x1c\x87\x97\x9b\xe5\xfc\x72\x78\xbd\x88\xc7\x0f\x4a\x56\x39\x66\x6a\xc7\xcd\x1a\x61\x0a\xae\x5d\xab\x21\x80\x68\x88\x2b\x57\x6a\xf0\x2e\x30\x60\xb6\xa6\x02\x59\x2a\x58\xb4\xa6\x21\x0d\xa1\x30\x96\x00\x33\xf1\xed\x28\xe7\x47\x2d\x76\x8d\xed\x48\xc3\x06\xe0\xdb\xd3\xc9\x94\x91\xde\xfe\x04\x5b\x80\xb1\xbf\xfe\x0f\x48\xa3\x50\x39\xc9\x7c\x1d\x30\xce\x0f\x57\xc8\xca\x37\x3f\x45\xec\x6f\x7f\x43\x4a\xa6\x94\x74\xa3\xea\xd6\x77\x2c\x78\xdf\x93\x06\xa6\x3d\x86\xaf\x22\x4a\xc3\x06\x84\xb7\xa6\xa0\xca\xd9\x92\x66\x1a\x86\xbb\xc7\x61\x71\x1a\xfb\xab\xb8\xe8\x53\xd1\xef\xe7\x47\xcb\xb3\xfb\x78\xf0\x0c\x42\xfe\xf0\x5f\xe8\xb6\x9b\x9a\x61\x9a\x2d\x19\x90\x98\x29\x39\x6e\x05\x3f\x02\x00\x00\xff\xff\xb3\x9f\x69\x73\xb2\x01\x00\x00"),
2018-08-01 03:18:23 +00:00
},
}
fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/index.tpl"].(os.FileInfo),
}
return fs
}()
type vfsgen۰FS map[string]interface{}
func (fs vfsgen۰FS) Open(path string) (http.File, error) {
path = pathpkg.Clean("/" + path)
f, ok := fs[path]
if !ok {
return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
}
switch f := f.(type) {
case *vfsgen۰CompressedFileInfo:
gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
if err != nil {
// This should never happen because we generate the gzip bytes such that they are always valid.
panic("unexpected error reading own gzip compressed bytes: " + err.Error())
}
return &vfsgen۰CompressedFile{
vfsgen۰CompressedFileInfo: f,
2019-09-19 08:45:45 +00:00
gr: gr,
2018-08-01 03:18:23 +00:00
}, nil
case *vfsgen۰DirInfo:
return &vfsgen۰Dir{
vfsgen۰DirInfo: f,
}, nil
default:
// This should never happen because we generate only the above types.
panic(fmt.Sprintf("unexpected type %T", f))
}
}
// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
type vfsgen۰CompressedFileInfo struct {
name string
modTime time.Time
compressedContent []byte
uncompressedSize int64
}
func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
}
func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
return f.compressedContent
}
func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
// vfsgen۰CompressedFile is an opened compressedFile instance.
type vfsgen۰CompressedFile struct {
*vfsgen۰CompressedFileInfo
gr *gzip.Reader
grPos int64 // Actual gr uncompressed position.
seekPos int64 // Seek uncompressed position.
}
func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
if f.grPos > f.seekPos {
// Rewind to beginning.
err = f.gr.Reset(bytes.NewReader(f.compressedContent))
if err != nil {
return 0, err
}
f.grPos = 0
}
if f.grPos < f.seekPos {
// Fast-forward.
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
if err != nil {
return 0, err
}
f.grPos = f.seekPos
}
n, err = f.gr.Read(p)
f.grPos += int64(n)
f.seekPos = f.grPos
return n, err
}
func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
switch whence {
case io.SeekStart:
f.seekPos = 0 + offset
case io.SeekCurrent:
f.seekPos += offset
case io.SeekEnd:
f.seekPos = f.uncompressedSize + offset
default:
panic(fmt.Errorf("invalid whence value: %v", whence))
}
return f.seekPos, nil
}
func (f *vfsgen۰CompressedFile) Close() error {
return f.gr.Close()
}
// vfsgen۰DirInfo is a static definition of a directory.
type vfsgen۰DirInfo struct {
name string
modTime time.Time
entries []os.FileInfo
}
func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
return 0, fmt.Errorf("cannot Read from directory %s", d.name)
}
func (d *vfsgen۰DirInfo) Close() error { return nil }
func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
func (d *vfsgen۰DirInfo) Name() string { return d.name }
func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
func (d *vfsgen۰DirInfo) IsDir() bool { return true }
func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
// vfsgen۰Dir is an opened dir instance.
type vfsgen۰Dir struct {
*vfsgen۰DirInfo
pos int // Position within entries for Seek and Readdir.
}
func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
if offset == 0 && whence == io.SeekStart {
d.pos = 0
return 0, nil
}
return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
}
func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
if d.pos >= len(d.entries) && count > 0 {
return nil, io.EOF
}
if count <= 0 || count > len(d.entries)-d.pos {
count = len(d.entries) - d.pos
}
e := d.entries[d.pos : d.pos+count]
d.pos += count
return e, nil
}