removing unused code

This commit is contained in:
Alex Yatskov 2019-01-08 18:46:45 -08:00
parent 9878545952
commit d271e2a0c2
2 changed files with 0 additions and 87 deletions

View File

@ -1,57 +0,0 @@
package streaming
import (
"errors"
"io"
)
type Writer interface {
io.WriteSeeker
}
type writer struct {
data []byte
offset int
}
func NewWriter(data []byte) Writer {
return &writer{data, 0}
}
func (w *writer) Write(data []byte) (int, error) {
length := len(data)
if w.offset+length > len(w.data) {
length = len(w.data) - w.offset
}
if length == 0 {
return 0, errors.New("cannot write past end of buffer")
}
copy(w.data[w.offset:], data[:length])
w.offset += length
return length, nil
}
func (w *writer) Seek(offset int64, whence int) (int64, error) {
result := w.offset
switch whence {
case io.SeekStart:
result = int(offset)
case io.SeekCurrent:
result = w.offset + int(offset)
case io.SeekEnd:
result = len(w.data) - int(offset)
}
if result < 0 {
return int64(w.offset), errors.New("cannot seek before beginning of buffer")
}
if result >= len(w.data) {
return int64(w.offset), errors.New("cannot seek past end of buffer")
}
w.offset = result
return int64(w.offset), nil
}

View File

@ -1,30 +0,0 @@
package filesystem
import (
"io"
)
type FileSystem interface {
Mount(root, path string) error
List() ([]string, error)
Open(path string) (io.ReadSeeker, error)
}
func New() FileSystem {
return new(filesystem)
}
type filesystem struct {
}
func (fs *filesystem) Mount(root, path string) error {
return nil
}
func (fs *filesystem) List() ([]string, error) {
return nil, nil
}
func (fs *filesystem) Open(path string) (io.ReadSeeker, error) {
return nil, nil
}