Documentation
¶
Index ¶
- Constants
- Variables
- func NewSmallDocumentBlock(bigBlockSize POIFSBigBlockSize) *smallDocumentBlock
- func RawDataBlock(r io.Reader, blocksize int) *rawDataBlock
- func RawDataBlockList(r io.Reader, bigBlockSize POIFSBigBlockSize) (*rawDataBlockList, error)
- func SmallDocBlockFromDataBlock(bigBlockSize POIFSBigBlockSize, store []BlockWritable, size int) []*smallDocumentBlock
- func SmallDocBlockFromRaw(bigBlockSize POIFSBigBlockSize, blocks []ListManagedBlock) []*smallDocumentBlock
- func SmallDocumentBlock(bigBlockSize POIFSBigBlockSize, data []byte, index int) *smallDocumentBlock
- func SmallDocumentBlockFill(bigBlockSize POIFSBigBlockSize, blocks *[]BlockWritable) int
- func SmallDocumentBlockList(blocks []*smallDocumentBlock) (*smallDocumentBlockList, error)
- type BATBlock
- func CreateBATBlock(bigBlockSize POIFSBigBlockSize, data bytes.Buffer) *BATBlock
- func CreateBATBlocks(bigBlockSize POIFSBigBlockSize, entries []int) []*BATBlock
- func CreateEmptyBATBlock(bigBlockSize POIFSBigBlockSize, isXBAT bool) *BATBlock
- func CreateXBATBlocks(bigBlockSize POIFSBigBlockSize, entries []int, startBlock int) []*BATBlock
- func NewBATBlock(bigBlockSize POIFSBigBlockSize) *BATBlock
- func NewBATBlockWithEntries(bigBlockSize POIFSBigBlockSize, entries []int, start_index, end_index int) *BATBlock
- type BATBlockAndIndex
- type BATManaged
- type BlockAllocationTableReader
- type BlockAllocationTableWriter
- func (b *BlockAllocationTableWriter) CountBlocks() int
- func (b *BlockAllocationTableWriter) CreateBlocks() int
- func (b *BlockAllocationTableWriter) GetStartBlock() int
- func (b *BlockAllocationTableWriter) SetStartBlock(start_block int)
- func (b *BlockAllocationTableWriter) WriteBlocks(stream io.Writer) error
- type BlockList
- type BlockWritable
- type ByteField
- type Child
- type ClassID
- type Comparator
- type DataInputBlock
- func (d *DataInputBlock) Available() int
- func (d *DataInputBlock) ReadFully(buf []byte, offset, length int)
- func (d *DataInputBlock) ReadIntLE() int
- func (d *DataInputBlock) ReadIntLE2(prevBlock *DataInputBlock, prevBlockAvailable int) int
- func (d *DataInputBlock) ReadUByte() int
- func (d *DataInputBlock) ReadUShortLE() int
- func (d *DataInputBlock) ReadUShortLE2(prevBlock *DataInputBlock) int
- type DirectoryEntry
- type DirectoryNode
- func (dn *DirectoryNode) ChangeName(oldName, newName string) bool
- func (dn *DirectoryNode) CreateDirectory(name string) DirectoryEntry
- func (dn *DirectoryNode) CreateDocument(name string, stream io.Reader) DocumentEntry
- func (dn *DirectoryNode) DeleteEntry(entry *EntryNode) bool
- func (dn *DirectoryNode) Entries() []Entry
- func (dn *DirectoryNode) Entry(name string) (Entry, error)
- func (dn *DirectoryNode) EntryCount() int
- func (dn *DirectoryNode) GetFileSystem() *POIFSFileSystem
- func (dn *DirectoryNode) GetPath() *POIFSDocumentPath
- func (dn *DirectoryNode) HasEntry(name string) bool
- func (dn *DirectoryNode) IsDeleteOK() bool
- func (dn *DirectoryNode) IsDirectory() bool
- func (dn *DirectoryNode) IsEmpty() bool
- func (dn *DirectoryNode) SetStorageClsId(cid ClassID)
- func (dn *DirectoryNode) StorageClsId() ClassID
- type DirectoryProperty
- func (doc *DirectoryProperty) AddChild(prop IProperty) error
- func (doc *DirectoryProperty) ChangeName(prop IProperty, newName string) bool
- func (doc *DirectoryProperty) DelChild(prop IProperty) bool
- func (doc *DirectoryProperty) GetChildren() []IProperty
- func (doc *DirectoryProperty) IsDirectory() bool
- func (doc *DirectoryProperty) PreWrite()
- type DocumentBlock
- type DocumentEntry
- type DocumentInputStream
- func (d *DocumentInputStream) Available() int
- func (d *DocumentInputStream) Close()
- func (d *DocumentInputStream) GetDataInputBlock(offset int) *DataInputBlock
- func (d *DocumentInputStream) Mark(ignoreReadLimit int)
- func (d *DocumentInputStream) Read(p []byte) (n int, err error)
- func (d *DocumentInputStream) Reset()
- type DocumentNode
- type DocumentProperty
- type Entry
- type EntryNode
- func (en *EntryNode) Delete() bool
- func (en *EntryNode) GetName() string
- func (en *EntryNode) GetProperty() IProperty
- func (en *EntryNode) IsDeleteOK() bool
- func (en *EntryNode) IsDirectory() bool
- func (en *EntryNode) IsDocument() bool
- func (en *EntryNode) IsRoot() bool
- func (en *EntryNode) Parent() DirectoryEntry
- func (en *EntryNode) RenameTo(newName string) bool
- type FixedField
- type HeaderBlock
- func (hb *HeaderBlock) GetBATArray() []int
- func (hb *HeaderBlock) GetBATCount() int
- func (hb *HeaderBlock) GetBigBlockSize() POIFSBigBlockSize
- func (hb *HeaderBlock) GetPropertyStart() int
- func (hb *HeaderBlock) GetSBATCount() int
- func (hb *HeaderBlock) GetSBATStart() int
- func (hb *HeaderBlock) GetXBATCount() int
- func (hb *HeaderBlock) GetXBATIndex() int
- func (hb *HeaderBlock) SetBATCount(count int)
- func (hb *HeaderBlock) SetPropertyStart(startBlock int)
- func (hb *HeaderBlock) SetSBATBlockCount(count int)
- func (hb *HeaderBlock) SetSBATStart(startBlock int)
- func (hb *HeaderBlock) SetXBATCount(count int)
- func (hb *HeaderBlock) SetXBATStart(sb int)
- func (hb *HeaderBlock) WriteData(w io.Writer) error
- type HeaderBlockWriter
- func (w *HeaderBlockWriter) SetBATBlocks(blockCount, startBlock int) []*BATBlock
- func (w *HeaderBlockWriter) SetPropertyStart(startBlock int)
- func (w *HeaderBlockWriter) SetSBATBlockCount(count int)
- func (w *HeaderBlockWriter) SetSBATStart(startBlock int)
- func (w *HeaderBlockWriter) WriteBlock(block *bytes.Buffer)
- func (w *HeaderBlockWriter) WriteBlocks(stream io.Writer) error
- type IProperty
- type IntegerField
- type Iterator
- type ListManagedBlock
- type POIFSBigBlockSize
- type POIFSDocument
- func NewPOIFSDocFromManagedBlock(name string, bigBlockSize POIFSBigBlockSize, blocks []ListManagedBlock, ...) *POIFSDocument
- func NewPOIFSDocFromManagedBlock2(name string, blocks []ListManagedBlock, length int) *POIFSDocument
- func NewPOIFSDocFromRaw(name string, blocks []*rawDataBlock, length int) *POIFSDocument
- func NewPOIFSDocFromSmallBlocks(name string, blocks []*smallDocumentBlock, length int) *POIFSDocument
- func NewPOIFSDocFromStream(name string, r io.Reader) (*POIFSDocument, error)
- func NewPOIFSDocFromStream2(name string, bigBlockSize POIFSBigBlockSize, r io.Reader) (*POIFSDocument, error)
- func (d *POIFSDocument) CountBlocks() int
- func (d *POIFSDocument) GetDataInputBlock(offset int) *DataInputBlock
- func (d *POIFSDocument) GetDocumentProperty() *DocumentProperty
- func (d *POIFSDocument) GetSmallBlocks() []BlockWritable
- func (d *POIFSDocument) SetStartBlock(index int)
- func (d *POIFSDocument) WriteBlocks(w io.Writer) error
- type POIFSDocumentPath
- type POIFSFileSystem
- func (fs *POIFSFileSystem) AddDirectory(prop ParentProperty)
- func (fs *POIFSFileSystem) AddDocument(doc *POIFSDocument)
- func (fs *POIFSFileSystem) CreateDir(name string) (DirectoryEntry, error)
- func (fs *POIFSFileSystem) CreateDocument(name string, r io.Reader) (DocumentEntry, error)
- func (fs *POIFSFileSystem) GetRoot() (*DirectoryNode, error)
- func (fs *POIFSFileSystem) Remove(entry Entry)
- func (fs *POIFSFileSystem) WriteFileSystem(output io.Writer) error
- type Parent
- type ParentProperty
- type Property
- func (p *Property) ChildIndex() int
- func (p *Property) GetIndex() int
- func (p *Property) GetName() string
- func (p *Property) GetNextChild() Child
- func (p *Property) GetNextChildIndex() int
- func (p *Property) GetPrevChildIndex() int
- func (p *Property) GetPreviousChild() Child
- func (p *Property) GetSize() int
- func (p *Property) GetStartBlock() int
- func (p *Property) GetStorageClsid() ClassID
- func (p *Property) IsDirectory() bool
- func (p *Property) SetChildProperty(child int)
- func (p *Property) SetIndex(index int)
- func (p *Property) SetName(name string)
- func (p *Property) SetNextChild(child Child)
- func (p *Property) SetNodeColor(nodeColor byte)
- func (p *Property) SetPreviousChild(child Child)
- func (p *Property) SetPropertyType(propertyType byte)
- func (p *Property) SetSize(size int)
- func (p *Property) SetStartBlock(startBlock int)
- func (p *Property) SetStorageClsid(cid ClassID)
- func (p *Property) ShortDescription() string
- func (p *Property) UseSmallBlocks() bool
- func (p *Property) WriteData(w io.Writer) error
- type PropertyBlock
- type PropertyComparator
- type PropertyTable
- func (pt *PropertyTable) AddProperty(prop IProperty)
- func (pt *PropertyTable) CountBlocks() int
- func (pt *PropertyTable) GetRoot() ParentProperty
- func (pt *PropertyTable) GetStartBlock() int
- func (pt *PropertyTable) PreWrite()
- func (pt *PropertyTable) RemoveProperty(prop IProperty)
- func (pt *PropertyTable) SetStartBlock(index int)
- func (pt *PropertyTable) WriteBlocks(w io.Writer) error
- type RootProperty
- type ShortField
- type SmallBlockTableWriter
- func (s *SmallBlockTableWriter) CountBlocks() int
- func (s *SmallBlockTableWriter) GetSBAT() *BlockAllocationTableWriter
- func (s *SmallBlockTableWriter) GetSBATBlockCount() int
- func (s *SmallBlockTableWriter) SetStartBlock(start_block int)
- func (s *SmallBlockTableWriter) WriteBlocks(w io.Writer) error
- type Stack
Constants ¶
const ( SIGNATURE uint64 = 0xE11AB1A1E011CFD0 SMALLER_BIG_BLOCK_SIZE = 0x0200 LARGER_BIG_BLOCK_SIZE = 0x1000 SMALL_BLOCK_SIZE = 0x0040 PROPERTY_SIZE = 0x0080 //How big single property is /** * The minimum size of a document before it's stored using * Big Blocks (normal streams). Smaller documents go in the * Mini Stream (SBAT / Small Blocks) */ BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000 /** The highest sector number you're allowed, 0xFFFFFFFA */ LARGEST_REGULAR_SECTOR_NUMBER = -5 /** Indicates the sector holds a DIFAT block (0xFFFFFFFC) */ DIFAT_SECTOR_BLOCK = -4 /** Indicates the sector holds a FAT block (0xFFFFFFFD) */ FAT_SECTOR_BLOCK = -3 /** Indicates the sector is the end of a chain (0xFFFFFFFE) */ END_OF_CHAIN = -2 /** Indicates the sector is not used (0xFFFFFFFF) */ UNUSED_BLOCK = -1 )
const ( BYTE_SIZE = 1 SHORT_SIZE = 2 INT_SIZE = 4 LONG_SIZE = 8 DOUBLE_SIZE = 8 )
const ( PROPERTY_TYPE_OFFSET int = 0x42 DIRECTORY_TYPE = 1 DOCUMENT_TYPE = 2 ROOT_TYPE = 5 )
const ( BLOCK_SHIFT = 6 BLOCK_MASK = _block_size - 1 MAX_BLOCK_COUNT = 65535 )
Variables ¶
var ( INVALID_FILE_FORMAT = errors.New("Not a valid compound file") READ_ERROR = errors.New("Error reading compound file") OOXML_FILE_FORMAT = errors.New("The supplied data appears to be in the Office 2007+ XML.") BLOCK_ERROR = errors.New("Unable to read Data Block") EMPTY_BLOCK_ERROR = errors.New("Can not return empty data") SMALLER_BIG_BLOCK_SIZE_DETAILS = NewBigBlockSize(SMALLER_BIG_BLOCK_SIZE, 9) LARGER_BIG_BLOCK_SIZE_DETAILS = NewBigBlockSize(LARGER_BIG_BLOCK_SIZE, 12) /** The first 4 bytes of an OOXML file, used in detection */ OOXML_FILE_HEADER = [4]byte{0x50, 0x4B, 0x03, 0x04} )
var (
CLOSED_STREAM_ERROR = errors.New("cannot perform requested operation on a closed stream")
)
Functions ¶
func NewSmallDocumentBlock ¶
func NewSmallDocumentBlock(bigBlockSize POIFSBigBlockSize) *smallDocumentBlock
func RawDataBlock ¶
func RawDataBlockList ¶
func RawDataBlockList(r io.Reader, bigBlockSize POIFSBigBlockSize) (*rawDataBlockList, error)
func SmallDocBlockFromDataBlock ¶
func SmallDocBlockFromDataBlock(bigBlockSize POIFSBigBlockSize, store []BlockWritable, size int) []*smallDocumentBlock
func SmallDocBlockFromRaw ¶
func SmallDocBlockFromRaw(bigBlockSize POIFSBigBlockSize, blocks []ListManagedBlock) []*smallDocumentBlock
func SmallDocumentBlock ¶
func SmallDocumentBlock(bigBlockSize POIFSBigBlockSize, data []byte, index int) *smallDocumentBlock
func SmallDocumentBlockFill ¶
func SmallDocumentBlockFill(bigBlockSize POIFSBigBlockSize, blocks *[]BlockWritable) int
func SmallDocumentBlockList ¶
func SmallDocumentBlockList(blocks []*smallDocumentBlock) (*smallDocumentBlockList, error)
Types ¶
type BATBlock ¶
type BATBlock struct {
// contains filtered or unexported fields
}
func CreateBATBlock ¶
func CreateBATBlock(bigBlockSize POIFSBigBlockSize, data bytes.Buffer) *BATBlock
func CreateBATBlocks ¶
func CreateBATBlocks(bigBlockSize POIFSBigBlockSize, entries []int) []*BATBlock
func CreateEmptyBATBlock ¶
func CreateEmptyBATBlock(bigBlockSize POIFSBigBlockSize, isXBAT bool) *BATBlock
func CreateXBATBlocks ¶
func CreateXBATBlocks(bigBlockSize POIFSBigBlockSize, entries []int, startBlock int) []*BATBlock
func NewBATBlock ¶
func NewBATBlock(bigBlockSize POIFSBigBlockSize) *BATBlock
Create a single instance initialized with default values
func NewBATBlockWithEntries ¶
func NewBATBlockWithEntries(bigBlockSize POIFSBigBlockSize, entries []int, start_index, end_index int) *BATBlock
Create a single instance initialized (perhaps partially) with entries
func (*BATBlock) GetOutBlockIndex ¶
func (*BATBlock) HasFreeSectors ¶
func (*BATBlock) SetOurBlockIndex ¶
func (*BATBlock) SetValueAt ¶
type BATBlockAndIndex ¶
type BATBlockAndIndex struct {
// contains filtered or unexported fields
}
func GetBATBlockAndIndex ¶
func GetBATBlockAndIndex(offset int, header HeaderBlock, bats []*BATBlock) *BATBlockAndIndex
*
- Returns the BATBlock that handles the specified offset,
- and the relative index within it, for the mini stream.
- The List of BATBlocks must be in sequential order
func GetSBATBlockAndIndex ¶
func GetSBATBlockAndIndex(offset int, header HeaderBlock, bats []*BATBlock) *BATBlockAndIndex
func (*BATBlockAndIndex) GetBlock ¶
func (bi *BATBlockAndIndex) GetBlock() *BATBlock
func (*BATBlockAndIndex) GetIndex ¶
func (bi *BATBlockAndIndex) GetIndex() int
type BATManaged ¶
type BlockAllocationTableReader ¶
type BlockAllocationTableReader struct {
// contains filtered or unexported fields
}
func NewBlockAllocationTableReader ¶
func NewBlockAllocationTableReader(bigBlockSize POIFSBigBlockSize, block_count int, block_array []int, xbat_count, xbat_index int, raw_blocklist BlockList) (*BlockAllocationTableReader, error)
func NewBlockAllocationTableReader1 ¶
func NewBlockAllocationTableReader1(bigBlockSize POIFSBigBlockSize, blocks []ListManagedBlock, raw_blocklist BlockList) (*BlockAllocationTableReader, error)
type BlockAllocationTableWriter ¶
type BlockAllocationTableWriter struct {
// contains filtered or unexported fields
}
func NewBlockAllocationTableWriter ¶
func NewBlockAllocationTableWriter(bigBlockSize POIFSBigBlockSize) *BlockAllocationTableWriter
func (*BlockAllocationTableWriter) CountBlocks ¶
func (b *BlockAllocationTableWriter) CountBlocks() int
func (*BlockAllocationTableWriter) CreateBlocks ¶
func (b *BlockAllocationTableWriter) CreateBlocks() int
func (*BlockAllocationTableWriter) GetStartBlock ¶
func (b *BlockAllocationTableWriter) GetStartBlock() int
func (*BlockAllocationTableWriter) SetStartBlock ¶
func (b *BlockAllocationTableWriter) SetStartBlock(start_block int)
func (*BlockAllocationTableWriter) WriteBlocks ¶
func (b *BlockAllocationTableWriter) WriteBlocks(stream io.Writer) error
type BlockList ¶
type BlockList interface { Zap(index int) Remove(index int) (ListManagedBlock, error) Fetch(startBlock, headerPropertiesStartBlock int) ([]ListManagedBlock, error) SetBAT(bat *BlockAllocationTableReader) error BlockCount() int }
func GetSmallDocumentBlocks ¶
func GetSmallDocumentBlocks(bigBlockSize POIFSBigBlockSize, blockList *rawDataBlockList, root *RootProperty, sbatStart int) (BlockList, error)
type BlockWritable ¶
func NewPropertyBlockArray ¶
func NewPropertyBlockArray(bigBlockSize POIFSBigBlockSize, props []IProperty) []BlockWritable
* Create an array of PropertyBlocks from an array of Property * instances, creating empty Property instances to make up any * shortfall
type ByteField ¶
type ByteField struct {
// contains filtered or unexported fields
}
func NewByteFieldFromBytes ¶
func NewByteFieldWithOffset ¶
func (*ByteField) ReadFromBytes ¶
func (*ByteField) WriteToBytes ¶
type ClassID ¶
type ClassID struct {
// contains filtered or unexported fields
}
func ClassIDFromBytes ¶
func ClassIDFromString ¶
func NewClassID ¶
func NewClassID() ClassID
type Comparator ¶
returns negative if p1 < p2 zero if p1 == p2 positive if p1 > p2
type DataInputBlock ¶
type DataInputBlock struct {
// contains filtered or unexported fields
}
func GetDataInputBlockFromDocumentBlocks ¶
func GetDataInputBlockFromDocumentBlocks(blocks []*DocumentBlock, offset int) *DataInputBlock
func GetDataInputBlockFromSmallBlocks ¶
func GetDataInputBlockFromSmallBlocks(blocks []*smallDocumentBlock, offset int) *DataInputBlock
func NewDataInputBlock ¶
func NewDataInputBlock(data []byte, startOffset int) *DataInputBlock
func (*DataInputBlock) Available ¶
func (d *DataInputBlock) Available() int
func (*DataInputBlock) ReadFully ¶
func (d *DataInputBlock) ReadFully(buf []byte, offset, length int)
func (*DataInputBlock) ReadIntLE ¶
func (d *DataInputBlock) ReadIntLE() int
func (*DataInputBlock) ReadIntLE2 ¶
func (d *DataInputBlock) ReadIntLE2(prevBlock *DataInputBlock, prevBlockAvailable int) int
func (*DataInputBlock) ReadUByte ¶
func (d *DataInputBlock) ReadUByte() int
func (*DataInputBlock) ReadUShortLE ¶
func (d *DataInputBlock) ReadUShortLE() int
func (*DataInputBlock) ReadUShortLE2 ¶
func (d *DataInputBlock) ReadUShortLE2(prevBlock *DataInputBlock) int
Reads a short which spans the end of prevBlock
type DirectoryEntry ¶
type DirectoryEntry interface { Entry Entries() []Entry IsEmpty() bool EntryCount() int HasEntry(name string) bool Entry(name string) (Entry, error) StorageClsId() ClassID SetStorageClsId(cid ClassID) //CreateDocument(name string, stream []byte) DocumentEntry CreateDocument(name string, r io.Reader) DocumentEntry CreateDirectory(name string) DirectoryEntry }
type DirectoryNode ¶
type DirectoryNode struct { *EntryNode // contains filtered or unexported fields }
func NewDirectoryNode ¶
func NewDirectoryNode(prop ParentProperty, fs *POIFSFileSystem, parent *DirectoryNode) (*DirectoryNode, error)
func (*DirectoryNode) ChangeName ¶
func (dn *DirectoryNode) ChangeName(oldName, newName string) bool
func (*DirectoryNode) CreateDirectory ¶
func (dn *DirectoryNode) CreateDirectory(name string) DirectoryEntry
func (*DirectoryNode) CreateDocument ¶
func (dn *DirectoryNode) CreateDocument(name string, stream io.Reader) DocumentEntry
func (dn *DirectoryNode) CreateDocument(name string, stream []byte) DocumentEntry {
func (*DirectoryNode) DeleteEntry ¶
func (dn *DirectoryNode) DeleteEntry(entry *EntryNode) bool
func (*DirectoryNode) Entries ¶
func (dn *DirectoryNode) Entries() []Entry
func (*DirectoryNode) EntryCount ¶
func (dn *DirectoryNode) EntryCount() int
func (*DirectoryNode) GetFileSystem ¶
func (dn *DirectoryNode) GetFileSystem() *POIFSFileSystem
func (*DirectoryNode) GetPath ¶
func (dn *DirectoryNode) GetPath() *POIFSDocumentPath
func (*DirectoryNode) HasEntry ¶
func (dn *DirectoryNode) HasEntry(name string) bool
func (*DirectoryNode) IsDeleteOK ¶
func (dn *DirectoryNode) IsDeleteOK() bool
func (*DirectoryNode) IsDirectory ¶
func (dn *DirectoryNode) IsDirectory() bool
func (*DirectoryNode) IsEmpty ¶
func (dn *DirectoryNode) IsEmpty() bool
func (*DirectoryNode) SetStorageClsId ¶
func (dn *DirectoryNode) SetStorageClsId(cid ClassID)
func (*DirectoryNode) StorageClsId ¶
func (dn *DirectoryNode) StorageClsId() ClassID
type DirectoryProperty ¶
type DirectoryProperty struct { *Property // contains filtered or unexported fields }
func NewDirProperty ¶
func NewDirProperty(name string) *DirectoryProperty
func NewDirPropertyFromData ¶
func NewDirPropertyFromData(index int, array []byte, offset int) *DirectoryProperty
func (*DirectoryProperty) AddChild ¶
func (doc *DirectoryProperty) AddChild(prop IProperty) error
func (*DirectoryProperty) ChangeName ¶
func (doc *DirectoryProperty) ChangeName(prop IProperty, newName string) bool
func (*DirectoryProperty) DelChild ¶
func (doc *DirectoryProperty) DelChild(prop IProperty) bool
func (*DirectoryProperty) GetChildren ¶
func (doc *DirectoryProperty) GetChildren() []IProperty
func (*DirectoryProperty) IsDirectory ¶
func (doc *DirectoryProperty) IsDirectory() bool
func (*DirectoryProperty) PreWrite ¶
func (doc *DirectoryProperty) PreWrite()
type DocumentBlock ¶
type DocumentBlock struct {
// contains filtered or unexported fields
}
func DocumentBlockFromRawBlock ¶
func DocumentBlockFromRawBlock(block *rawDataBlock) (*DocumentBlock, error)
func DocumentBlockFromStream ¶
func DocumentBlockFromStream(r io.Reader, bigBlockSize POIFSBigBlockSize) (db *DocumentBlock, err error)
func DocumentBlockFromStream(data []byte, bigBlockSize POIFSBigBlockSize) (*DocumentBlock, error) {
func (*DocumentBlock) PartiallyRead ¶
func (db *DocumentBlock) PartiallyRead() bool
func (*DocumentBlock) Size ¶
func (db *DocumentBlock) Size() int
func (*DocumentBlock) WriteBlocks ¶
func (db *DocumentBlock) WriteBlocks(w io.Writer) error
type DocumentEntry ¶
type DocumentInputStream ¶
type DocumentInputStream struct {
// contains filtered or unexported fields
}
func NewDocInputStream ¶
func NewDocInputStream(doc *POIFSDocument) *DocumentInputStream
func NewDocInputStreamFromDocNode ¶
func NewDocInputStreamFromDocNode(doc *DocumentNode) *DocumentInputStream
func NewDocInputStreamFromEntry ¶
func NewDocInputStreamFromEntry(entry DocumentEntry) *DocumentInputStream
func (*DocumentInputStream) Available ¶
func (d *DocumentInputStream) Available() int
func (*DocumentInputStream) Close ¶
func (d *DocumentInputStream) Close()
func (*DocumentInputStream) GetDataInputBlock ¶
func (d *DocumentInputStream) GetDataInputBlock(offset int) *DataInputBlock
func (*DocumentInputStream) Mark ¶
func (d *DocumentInputStream) Mark(ignoreReadLimit int)
func (*DocumentInputStream) Reset ¶
func (d *DocumentInputStream) Reset()
type DocumentNode ¶
type DocumentNode struct { *EntryNode // contains filtered or unexported fields }
func NewDocumentNode ¶
func NewDocumentNode(prop *DocumentProperty, parent *DirectoryNode) *DocumentNode
func (*DocumentNode) GetDocument ¶
func (dn *DocumentNode) GetDocument() *POIFSDocument
func (*DocumentNode) GetSize ¶
func (dn *DocumentNode) GetSize() int
func (*DocumentNode) IsDeleteOK ¶
func (dn *DocumentNode) IsDeleteOK() bool
func (*DocumentNode) IsDocument ¶
func (dn *DocumentNode) IsDocument() bool
type DocumentProperty ¶
type DocumentProperty struct { *Property // contains filtered or unexported fields }
func NewDocProperty ¶
func NewDocProperty(name string, size int) *DocumentProperty
func NewDocPropertyFromData ¶
func NewDocPropertyFromData(index int, array []byte, offset int) *DocumentProperty
func (*DocumentProperty) IsDirectory ¶
func (doc *DocumentProperty) IsDirectory() bool
func (*DocumentProperty) PreWrite ¶
func (doc *DocumentProperty) PreWrite()
func (*DocumentProperty) SetDocument ¶
func (doc *DocumentProperty) SetDocument(d *POIFSDocument)
func (*DocumentProperty) ShouldUseSmallBlocks ¶
func (doc *DocumentProperty) ShouldUseSmallBlocks() bool
type EntryNode ¶
type EntryNode struct {
// contains filtered or unexported fields
}
func NewEntryNode ¶
func NewEntryNode(prop IProperty, parent *DirectoryNode) *EntryNode
func (*EntryNode) GetProperty ¶
func (*EntryNode) IsDeleteOK ¶
func (*EntryNode) IsDirectory ¶
func (*EntryNode) IsDocument ¶
func (*EntryNode) Parent ¶
func (en *EntryNode) Parent() DirectoryEntry
type FixedField ¶
type HeaderBlock ¶
type HeaderBlock struct {
// contains filtered or unexported fields
}
func NewHeaderBlock ¶
func NewHeaderBlock(bigBlockSize POIFSBigBlockSize) *HeaderBlock
Create Header Block initialized with default values
func NewHeaderBlockFromReader ¶
func NewHeaderBlockFromReader(r io.Reader) (*HeaderBlock, error)
func (*HeaderBlock) GetBATArray ¶
func (hb *HeaderBlock) GetBATArray() []int
func (*HeaderBlock) GetBATCount ¶
func (hb *HeaderBlock) GetBATCount() int
func (*HeaderBlock) GetBigBlockSize ¶
func (hb *HeaderBlock) GetBigBlockSize() POIFSBigBlockSize
func (*HeaderBlock) GetPropertyStart ¶
func (hb *HeaderBlock) GetPropertyStart() int
func (*HeaderBlock) GetSBATCount ¶
func (hb *HeaderBlock) GetSBATCount() int
func (*HeaderBlock) GetSBATStart ¶
func (hb *HeaderBlock) GetSBATStart() int
return start of small block (MiniFAT) allocation table
func (*HeaderBlock) GetXBATCount ¶
func (hb *HeaderBlock) GetXBATCount() int
func (*HeaderBlock) GetXBATIndex ¶
func (hb *HeaderBlock) GetXBATIndex() int
func (*HeaderBlock) SetBATCount ¶
func (hb *HeaderBlock) SetBATCount(count int)
func (*HeaderBlock) SetPropertyStart ¶
func (hb *HeaderBlock) SetPropertyStart(startBlock int)
func (*HeaderBlock) SetSBATBlockCount ¶
func (hb *HeaderBlock) SetSBATBlockCount(count int)
func (*HeaderBlock) SetSBATStart ¶
func (hb *HeaderBlock) SetSBATStart(startBlock int)
func (*HeaderBlock) SetXBATCount ¶
func (hb *HeaderBlock) SetXBATCount(count int)
func (*HeaderBlock) SetXBATStart ¶
func (hb *HeaderBlock) SetXBATStart(sb int)
type HeaderBlockWriter ¶
type HeaderBlockWriter struct {
// contains filtered or unexported fields
}
func NewHeaderBlockWriter ¶
func NewHeaderBlockWriter(bigBlockSize POIFSBigBlockSize) *HeaderBlockWriter
func NewHeaderBlockWriterFromHeaderBlock ¶
func NewHeaderBlockWriterFromHeaderBlock(hb *HeaderBlock) *HeaderBlockWriter
func (*HeaderBlockWriter) SetBATBlocks ¶
func (w *HeaderBlockWriter) SetBATBlocks(blockCount, startBlock int) []*BATBlock
func (*HeaderBlockWriter) SetPropertyStart ¶
func (w *HeaderBlockWriter) SetPropertyStart(startBlock int)
func (*HeaderBlockWriter) SetSBATBlockCount ¶
func (w *HeaderBlockWriter) SetSBATBlockCount(count int)
func (*HeaderBlockWriter) SetSBATStart ¶
func (w *HeaderBlockWriter) SetSBATStart(startBlock int)
func (*HeaderBlockWriter) WriteBlock ¶
func (w *HeaderBlockWriter) WriteBlock(block *bytes.Buffer)
func (*HeaderBlockWriter) WriteBlocks ¶
func (w *HeaderBlockWriter) WriteBlocks(stream io.Writer) error
type IProperty ¶
type IProperty interface { Child GetSize() int SetSize(size int) SetNodeColor(nodeColor byte) SetPropertyType(propertyType byte) SetStartBlock(startBlock int) IsDirectory() bool GetName() string SetName(name string) GetPrevChildIndex() int GetNextChildIndex() int ChildIndex() int GetStorageClsid() ClassID SetStorageClsid(cid ClassID) GetStartBlock() int UseSmallBlocks() bool SetIndex(index int) WriteData(w io.Writer) error PreWrite() SetChildProperty(child int) GetIndex() int }
type IntegerField ¶
type IntegerField struct {
// contains filtered or unexported fields
}
func NewIntegerField ¶
func NewIntegerField(offset, value int, data []byte) (*IntegerField, error)
func NewIntegerFieldFromBytes ¶
func NewIntegerFieldFromBytes(offset int, data []byte) (*IntegerField, error)
func NewIntegerFieldWithOffset ¶
func NewIntegerFieldWithOffset(offset int) (*IntegerField, error)
func NewIntegerFieldWithVal ¶
func NewIntegerFieldWithVal(offset, value int) (*IntegerField, error)
func (*IntegerField) ReadFromBytes ¶
func (f *IntegerField) ReadFromBytes(data []byte)
func (*IntegerField) Set ¶
func (f *IntegerField) Set(val int, data []byte)
func (*IntegerField) String ¶
func (f *IntegerField) String() string
func (*IntegerField) WriteToBytes ¶
func (f *IntegerField) WriteToBytes(data []byte)
type ListManagedBlock ¶
type POIFSBigBlockSize ¶
func NewBigBlockSize ¶
func NewBigBlockSize(blocksize int, headval int16) POIFSBigBlockSize
func (POIFSBigBlockSize) BATEntriesPerBlock ¶
func (b POIFSBigBlockSize) BATEntriesPerBlock() int
func (POIFSBigBlockSize) NextXBATChainOffset ¶
func (b POIFSBigBlockSize) NextXBATChainOffset() int
func (POIFSBigBlockSize) PropertiesPerBlock ¶
func (b POIFSBigBlockSize) PropertiesPerBlock() int
func (POIFSBigBlockSize) XBATEntriesPerBlock ¶
func (b POIFSBigBlockSize) XBATEntriesPerBlock() int
type POIFSDocument ¶
type POIFSDocument struct {
// contains filtered or unexported fields
}
func NewPOIFSDocFromManagedBlock ¶
func NewPOIFSDocFromManagedBlock(name string, bigBlockSize POIFSBigBlockSize, blocks []ListManagedBlock, length int) *POIFSDocument
func NewPOIFSDocFromManagedBlock2 ¶
func NewPOIFSDocFromManagedBlock2(name string, blocks []ListManagedBlock, length int) *POIFSDocument
func NewPOIFSDocFromRaw ¶
func NewPOIFSDocFromRaw(name string, blocks []*rawDataBlock, length int) *POIFSDocument
func NewPOIFSDocFromSmallBlocks ¶
func NewPOIFSDocFromSmallBlocks(name string, blocks []*smallDocumentBlock, length int) *POIFSDocument
func NewPOIFSDocFromStream ¶
func NewPOIFSDocFromStream(name string, r io.Reader) (*POIFSDocument, error)
func NewPOIFSDocFromStream(name string, data []byte) (*POIFSDocument, error) {
func NewPOIFSDocFromStream2 ¶
func NewPOIFSDocFromStream2(name string, bigBlockSize POIFSBigBlockSize, r io.Reader) (*POIFSDocument, error)
func NewPOIFSDocFromStream2(name string, bigBlockSize POIFSBigBlockSize, data []byte) (*POIFSDocument, error) {
func (*POIFSDocument) CountBlocks ¶
func (d *POIFSDocument) CountBlocks() int
func (*POIFSDocument) GetDataInputBlock ¶
func (d *POIFSDocument) GetDataInputBlock(offset int) *DataInputBlock
func (*POIFSDocument) GetDocumentProperty ¶
func (d *POIFSDocument) GetDocumentProperty() *DocumentProperty
func (*POIFSDocument) GetSmallBlocks ¶
func (d *POIFSDocument) GetSmallBlocks() []BlockWritable
func (*POIFSDocument) SetStartBlock ¶
func (d *POIFSDocument) SetStartBlock(index int)
func (*POIFSDocument) WriteBlocks ¶
func (d *POIFSDocument) WriteBlocks(w io.Writer) error
type POIFSDocumentPath ¶
type POIFSDocumentPath struct {
// contains filtered or unexported fields
}
func AddPathToPOIFSDocumentPath ¶
func AddPathToPOIFSDocumentPath(path *POIFSDocumentPath, components []string) (*POIFSDocumentPath, error)
func CreatePOIFSDocumentPath ¶
func CreatePOIFSDocumentPath() (*POIFSDocumentPath, error)
func NewPOIFSDocumentPath ¶
func NewPOIFSDocumentPath(components []string) (*POIFSDocumentPath, error)
func (*POIFSDocumentPath) GetComponent ¶
func (dp *POIFSDocumentPath) GetComponent(n int) string
func (*POIFSDocumentPath) GetParent ¶
func (dp *POIFSDocumentPath) GetParent() *POIFSDocumentPath
func (*POIFSDocumentPath) Hashcode ¶
func (dp *POIFSDocumentPath) Hashcode() int
func (*POIFSDocumentPath) Length ¶
func (dp *POIFSDocumentPath) Length() int
func (*POIFSDocumentPath) String ¶
func (dp *POIFSDocumentPath) String() string
type POIFSFileSystem ¶
type POIFSFileSystem struct {
// contains filtered or unexported fields
}
func FileSystemFromReader ¶
func FileSystemFromReader(r io.Reader) (*POIFSFileSystem, error)
Create Filesystem from Reader. Reader is read until EOF.
func NewFileSystem ¶
func NewFileSystem() *POIFSFileSystem
Create POIFS FileSystem intended for writing
func (*POIFSFileSystem) AddDirectory ¶
func (fs *POIFSFileSystem) AddDirectory(prop ParentProperty)
func (*POIFSFileSystem) AddDocument ¶
func (fs *POIFSFileSystem) AddDocument(doc *POIFSDocument)
func (*POIFSFileSystem) CreateDir ¶
func (fs *POIFSFileSystem) CreateDir(name string) (DirectoryEntry, error)
func (*POIFSFileSystem) CreateDocument ¶
func (fs *POIFSFileSystem) CreateDocument(name string, r io.Reader) (DocumentEntry, error)
func (fs *POIFSFileSystem) CreateDocument(name string, data []byte) (DocumentEntry, error) {
func (*POIFSFileSystem) GetRoot ¶
func (fs *POIFSFileSystem) GetRoot() (*DirectoryNode, error)
func (*POIFSFileSystem) Remove ¶
func (fs *POIFSFileSystem) Remove(entry Entry)
func (*POIFSFileSystem) WriteFileSystem ¶
func (fs *POIFSFileSystem) WriteFileSystem(output io.Writer) error
type ParentProperty ¶
type ChildProperty interface { IProperty Child }
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
func CreateProperty ¶
func CreateProperty() *Property
func (*Property) ChildIndex ¶
func (*Property) GetNextChild ¶
func (*Property) GetNextChildIndex ¶
func (*Property) GetPrevChildIndex ¶
func (*Property) GetPreviousChild ¶
func (*Property) GetStartBlock ¶
func (*Property) GetStorageClsid ¶
func (*Property) IsDirectory ¶
func (*Property) SetChildProperty ¶
child the child property's index in the Property Table
func (*Property) SetNextChild ¶
func (*Property) SetNodeColor ¶
func (*Property) SetPreviousChild ¶
func (*Property) SetPropertyType ¶
func (*Property) SetStartBlock ¶
func (*Property) SetStorageClsid ¶
func (*Property) ShortDescription ¶
func (*Property) UseSmallBlocks ¶
type PropertyBlock ¶
type PropertyBlock struct {
// contains filtered or unexported fields
}
func NewPropertyBlock ¶
func NewPropertyBlock(bigBlockSize POIFSBigBlockSize) *PropertyBlock
func (*PropertyBlock) WriteBlocks ¶
func (pb *PropertyBlock) WriteBlocks(w io.Writer) error
type PropertyComparator ¶
type PropertyComparator struct {
// contains filtered or unexported fields
}
PropertySorter implements the Sort interface, Sorting the changes within
func PropertySorter ¶
func PropertySorter(compare Comparator) *PropertyComparator
returns a Comparator that sorts using the compare function
func (*PropertyComparator) Len ¶
func (pc *PropertyComparator) Len() int
Len is part of sort.Interface.
func (*PropertyComparator) Less ¶
func (pc *PropertyComparator) Less(i, j int) bool
Less is part of sort.Interface.
func (*PropertyComparator) Sort ¶
func (pc *PropertyComparator) Sort(props []IProperty)
Sort sorts the argument slice according to the less functions passed to PropertySorter.
func (*PropertyComparator) Swap ¶
func (pc *PropertyComparator) Swap(i, j int)
Swap is part of sort.Interface.
type PropertyTable ¶
type PropertyTable struct {
// contains filtered or unexported fields
}
func NewPropertyTable ¶
func NewPropertyTable(hb *HeaderBlock) *PropertyTable
func NewPropertyTableWithList ¶
func NewPropertyTableWithList(hb *HeaderBlock, blocklist *rawDataBlockList) (*PropertyTable, error)
func NewPropertyTableWithProps ¶
func NewPropertyTableWithProps(hb *HeaderBlock, props []IProperty) *PropertyTable
func (*PropertyTable) AddProperty ¶
func (pt *PropertyTable) AddProperty(prop IProperty)
func (*PropertyTable) CountBlocks ¶
func (pt *PropertyTable) CountBlocks() int
func (*PropertyTable) GetRoot ¶
func (pt *PropertyTable) GetRoot() ParentProperty
func (*PropertyTable) GetStartBlock ¶
func (pt *PropertyTable) GetStartBlock() int
func (*PropertyTable) RemoveProperty ¶
func (pt *PropertyTable) RemoveProperty(prop IProperty)
func (*PropertyTable) SetStartBlock ¶
func (pt *PropertyTable) SetStartBlock(index int)
func (*PropertyTable) WriteBlocks ¶
func (pt *PropertyTable) WriteBlocks(w io.Writer) error
type RootProperty ¶
type RootProperty struct {
*DirectoryProperty
}
func NewRootProperty ¶
func NewRootProperty() *RootProperty
func NewRootPropertyFromData ¶
func NewRootPropertyFromData(index int, array []byte, offset int) *RootProperty
func (*RootProperty) SetSize ¶
func (p *RootProperty) SetSize(size int)
type ShortField ¶
type ShortField struct {
// contains filtered or unexported fields
}
func NewShortField ¶
func NewShortField(offset int, value int16, data []byte) (*ShortField, error)
func NewShortFieldFromBytes ¶
func NewShortFieldFromBytes(offset int, data []byte) (*ShortField, error)
func NewShortFieldWithOffset ¶
func NewShortFieldWithOffset(offset int) (*ShortField, error)
func NewShortFieldWithVal ¶
func NewShortFieldWithVal(offset int, value int16) (*ShortField, error)
func (*ShortField) ReadFromBytes ¶
func (f *ShortField) ReadFromBytes(data []byte)
func (*ShortField) Set ¶
func (f *ShortField) Set(val int16, data []byte)
func (*ShortField) String ¶
func (f *ShortField) String() string
func (*ShortField) WriteToBytes ¶
func (f *ShortField) WriteToBytes(data []byte)
type SmallBlockTableWriter ¶
type SmallBlockTableWriter struct {
// contains filtered or unexported fields
}
func NewSmalBlockTableWriter ¶
func NewSmalBlockTableWriter(bigBlockSize POIFSBigBlockSize, documents []*POIFSDocument, root *RootProperty) *SmallBlockTableWriter
func (*SmallBlockTableWriter) CountBlocks ¶
func (s *SmallBlockTableWriter) CountBlocks() int
func (*SmallBlockTableWriter) GetSBAT ¶
func (s *SmallBlockTableWriter) GetSBAT() *BlockAllocationTableWriter
func (*SmallBlockTableWriter) GetSBATBlockCount ¶
func (s *SmallBlockTableWriter) GetSBATBlockCount() int
func (*SmallBlockTableWriter) SetStartBlock ¶
func (s *SmallBlockTableWriter) SetStartBlock(start_block int)
func (*SmallBlockTableWriter) WriteBlocks ¶
func (s *SmallBlockTableWriter) WriteBlocks(w io.Writer) error