Package org.exbin.xbup.core.block
Class XBDefaultEditableDocument
- java.lang.Object
-
- org.exbin.xbup.core.block.XBDefaultEditableDocument
-
- All Implemented Interfaces:
XBDocument
,XBEditableDocument
@ParametersAreNonnullByDefault public class XBDefaultEditableDocument extends java.lang.Object implements XBEditableDocument
Basic plain implementation of XBEditableDocument interface.
-
-
Constructor Summary
Constructors Constructor Description XBDefaultEditableDocument(XBBlock rootBlock)
XBDefaultEditableDocument(XBBlock rootBlock, org.exbin.auxiliary.paged_data.BinaryData tailData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all data in this document.long
getDocumentSize()
Returns size of the whole document if available.java.util.Optional<XBBlock>
getRootBlock()
Returns root block of the document.java.util.Optional<java.io.InputStream>
getTailData()
Returns tail data input stream.long
getTailDataSize()
Returns size of the tail data if available.void
setRootBlock(XBBlock block)
Sets root block of the document.void
setTailData(java.io.InputStream source)
Sets tail data.
-
-
-
Method Detail
-
getRootBlock
@Nonnull public java.util.Optional<XBBlock> getRootBlock()
Description copied from interface:XBDocument
Returns root block of the document.- Specified by:
getRootBlock
in interfaceXBDocument
- Returns:
- root block if exits or null.
-
getTailData
@Nonnull public java.util.Optional<java.io.InputStream> getTailData()
Description copied from interface:XBDocument
Returns tail data input stream.- Specified by:
getTailData
in interfaceXBDocument
- Returns:
- InputStream of providing read access to data area
-
getTailDataSize
public long getTailDataSize()
Description copied from interface:XBDocument
Returns size of the tail data if available.- Specified by:
getTailDataSize
in interfaceXBDocument
- Returns:
- length of tail data in bytes or -1 if not available or is infinite
-
getDocumentSize
public long getDocumentSize()
Description copied from interface:XBDocument
Returns size of the whole document if available.- Specified by:
getDocumentSize
in interfaceXBDocument
- Returns:
- length of whole document in bytes or -1 if not available or is infinite
-
setRootBlock
public void setRootBlock(XBBlock block)
Description copied from interface:XBEditableDocument
Sets root block of the document.- Specified by:
setRootBlock
in interfaceXBEditableDocument
- Parameters:
block
- the block to use as root block for this document
-
setTailData
public void setTailData(@Nullable java.io.InputStream source) throws java.io.IOException
Description copied from interface:XBEditableDocument
Sets tail data.- Specified by:
setTailData
in interfaceXBEditableDocument
- Parameters:
source
- data stream- Throws:
java.io.IOException
- exception on input/output error
-
clear
public void clear()
Description copied from interface:XBEditableDocument
Clears all data in this document.- Specified by:
clear
in interfaceXBEditableDocument
-
-