Class CompoundFile
java.lang.Object
com.independentsoft.io.structuredstorage.CompoundFile
Represents a file used to store data as virtual streams.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of the CompoundFile class.CompoundFile(InputStream stream)Initializes a new instance of the CompoundFile class from the stream.CompoundFile(String filePath)Initializes a new instance of the CompoundFile class from the file. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets compound file class ID.intGets FAT sector count.Gets stream to read from this compound file.shortGets major version.longGets count of mini FAT sectors.shortGets size of mini sectors.longGets maximum size of mini streams.getRoot()Gets the root node.shortGets FAT sector size.voidopen(InputStream inputStream)Opens compound file from the specified stream.voidOpens compound file from the specified file.voidsave(OutputStream outputStream)Saves this compound file to the specified stream.voidSaves this compound file to the specified file.voidSaves this compound file to the specified file.voidsetClassId(byte[] classId)Sets compound file class ID.voidsetMajorVersion(short majorVersion)Sets major version.byte[]Gets buffer to read from this compound file.
-
Constructor Details
-
CompoundFile
public CompoundFile()Initializes a new instance of the CompoundFile class. -
CompoundFile
Initializes a new instance of the CompoundFile class from the file.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
CompoundFile
Initializes a new instance of the CompoundFile class from the stream.- Parameters:
stream- the stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
-
Method Details
-
open
Opens compound file from the specified file.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
open
Opens compound file from the specified stream.- Parameters:
inputStream- the input stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getInputStream
Gets stream to read from this compound file.- Returns:
- the input stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
toByteArray
Gets buffer to read from this compound file.- Returns:
- the byte[]
- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Saves this compound file to the specified file.- Parameters:
filePath- File path.- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Saves this compound file to the specified file.- Parameters:
filePath- File path.overwrite- if true overwrites existing file with the same file path.- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Saves this compound file to the specified stream.- Parameters:
outputStream- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getRoot
Gets the root node.- Returns:
- the root
-
getMajorVersion
public short getMajorVersion()Gets major version. Allowed values are 3 (512 bytes sector size) or 4 (4096 bytes sector size).- Returns:
- the major version
-
setMajorVersion
public void setMajorVersion(short majorVersion)Sets major version. Allowed values are 3 (512 bytes sector size) or 4 (4096 bytes sector size).- Parameters:
majorVersion- the new major version
-
getSectorSize
public short getSectorSize()Gets FAT sector size.- Returns:
- the sector size
-
getMiniSectorSize
public short getMiniSectorSize()Gets size of mini sectors.- Returns:
- the mini sector size
-
getFatSectorCount
public int getFatSectorCount()Gets FAT sector count.- Returns:
- the fat sector count
-
getMiniStreamMaxSize
public long getMiniStreamMaxSize()Gets maximum size of mini streams.- Returns:
- the mini stream max size
-
getMiniFatSectorCount
public long getMiniFatSectorCount()Gets count of mini FAT sectors.- Returns:
- the mini fat sector count
-
getClassId
public byte[] getClassId()Gets compound file class ID.- Returns:
- the class id
-
setClassId
public void setClassId(byte[] classId)Sets compound file class ID.- Parameters:
classId- the new class id
-