Fix comments for documentation

This commit is contained in:
Terence Boldt 2022-01-23 18:51:44 -05:00
parent e590b82196
commit 7f727a6377
2 changed files with 15 additions and 5 deletions

View File

@ -39,11 +39,17 @@ type DirectoryHeader struct {
}
const (
// File is deleted
StorageDeleted = 0
// File is <= 512 bytes
StorageSeedling = 1
// File is > 512 bytes and <= 128 KB
StorageSapling = 2
// File is > 128 KB and <= 16 MB
StorageTree = 3
// Pacal storage area
StoragePascal = 4
// Directory
StorageDirectory = 13
)

View File

@ -6,20 +6,24 @@
package prodos
// MemoryFile containts file data and size
type MemoryFile struct {
data []byte
size int
}
// NewMemoryFile creates an in-memory file of the specified size in bytes
func NewMemoryFile(size int) *MemoryFile {
return &MemoryFile{make([]byte, size), size}
}
// WriteAt writes data to the specified offset in the file
func (memoryFile *MemoryFile) WriteAt(data []byte, offset int64) (int, error) {
copy(memoryFile.data[int(offset):], data)
return len(data), nil
}
// ReadAt reads data from the specified offset in the file
func (memoryFile *MemoryFile) ReadAt(data []byte, offset int64) (int, error) {
copy(data, memoryFile.data[int(offset):])
return len(data), nil