diff --git a/streaming/bytewriter.go b/streaming/bytewriter.go deleted file mode 100644 index 1ef4da2..0000000 --- a/streaming/bytewriter.go +++ /dev/null @@ -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 -} diff --git a/streaming/filesystem/filesystem.go b/streaming/filesystem/filesystem.go deleted file mode 100644 index ecd9101..0000000 --- a/streaming/filesystem/filesystem.go +++ /dev/null @@ -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 -}