Class SegmentsRepository
- java.lang.Object
 - 
- org.exbin.auxiliary.paged_data.delta.SegmentsRepository
 
 
- 
@ParametersAreNonnullByDefault public class SegmentsRepository extends java.lang.ObjectRepository of delta segments. 
- 
- 
Constructor Summary
Constructors Constructor Description SegmentsRepository()SegmentsRepository(org.exbin.auxiliary.paged_data.DataPageProvider dataPageProvider) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseFileSource(FileDataSource fileSource)voidcloseMemorySource(MemoryDataSource memorySource)DataSegmentcopySegment(DataSegment segment)Creates copy of segment.DataSegmentcopySegment(DataSegment segment, long offset, long length)Creates copy of segment.DeltaDocumentcreateDocument()Creates empty delta document.DeltaDocumentcreateDocument(FileDataSource fileSource)Creates delta document for given file source.FileSegmentcreateFileSegment(FileDataSource fileSource, long startPosition, long length)Creates new file segment on given file source.MemorySegmentcreateMemorySegment()MemorySegmentcreateMemorySegment(MemoryDataSource memorySource, long startPosition, long length)Creates new memory segment on given memory source.voiddetachFileSource(FileDataSource fileSource)Loads all segments from given source file to memory.voiddetachMemoryArea(MemorySegment memorySegment, long segmentPosition, long length)Detaches all other memory segments crossing given area of provided memory segment.voiddetachSegment(MemorySegment memorySegment)voiddropDocument(DeltaDocument document)voiddropFileSegment(FileSegment fileSegment)voiddropMemorySegment(MemorySegment memorySegment)voiddropSegment(DataSegment segment)voidinsertMemoryData(MemorySegment memorySegment, long segmentPosition, byte[] insertedData)voidinsertMemoryData(MemorySegment memorySegment, long segmentPosition, byte[] insertedData, int insertedDataOffset, int insertedDataLength)voidinsertMemoryData(MemorySegment memorySegment, long segmentPosition, long length)voidinsertMemoryData(MemorySegment memorySegment, long segmentPosition, org.exbin.auxiliary.paged_data.BinaryData insertedData)voidinsertMemoryData(MemorySegment memorySegment, long segmentPosition, org.exbin.auxiliary.paged_data.BinaryData insertedData, long insertedDataOffset, long insertedDataLength)voidinsertUninitializedMemoryData(MemorySegment memorySegment, long segmentPosition, long length)FileDataSourceopenFileSource(java.io.File sourceFile)FileDataSourceopenFileSource(java.io.File sourceFile, FileDataSource.EditMode editMode)MemoryDataSourceopenMemorySource()voidsaveDocument(DeltaDocument savedDocument)Saves document to it's source file and update all documents.voidsetMemoryByte(MemorySegment memorySegment, long segmentPosition, byte value)Sets byte to given segment.voidupdateSegment(DataSegment segment, long position, long length)voidupdateSegmentLength(DataSegment segment, long length) 
 - 
 
- 
- 
Method Detail
- 
openFileSource
@Nonnull public FileDataSource openFileSource(java.io.File sourceFile) throws java.io.IOException
- Throws:
 java.io.IOException
 
- 
openFileSource
@Nonnull public FileDataSource openFileSource(java.io.File sourceFile, FileDataSource.EditMode editMode) throws java.io.IOException
- Throws:
 java.io.IOException
 
- 
closeFileSource
public void closeFileSource(FileDataSource fileSource)
 
- 
openMemorySource
@Nonnull public MemoryDataSource openMemorySource()
 
- 
closeMemorySource
public void closeMemorySource(MemoryDataSource memorySource)
 
- 
createDocument
@Nonnull public DeltaDocument createDocument()
Creates empty delta document.- Returns:
 - delta document
 
 
- 
createDocument
@Nonnull public DeltaDocument createDocument(FileDataSource fileSource) throws java.io.IOException
Creates delta document for given file source.- Parameters:
 fileSource- file source- Returns:
 - delta document
 - Throws:
 java.io.IOException- if input/output error
 
- 
saveDocument
public void saveDocument(DeltaDocument savedDocument) throws java.io.IOException
Saves document to it's source file and update all documents.- Parameters:
 savedDocument- document to save- Throws:
 java.io.IOException- if input/output error
 
- 
createFileSegment
@Nonnull public FileSegment createFileSegment(FileDataSource fileSource, long startPosition, long length)
Creates new file segment on given file source.- Parameters:
 fileSource- file sourcestartPosition- start positionlength- length- Returns:
 - file segment
 
 
- 
dropFileSegment
public void dropFileSegment(FileSegment fileSegment)
 
- 
createMemorySegment
@Nonnull public MemorySegment createMemorySegment()
 
- 
createMemorySegment
@Nonnull public MemorySegment createMemorySegment(MemoryDataSource memorySource, long startPosition, long length)
Creates new memory segment on given memory source.- Parameters:
 memorySource- memory sourcestartPosition- start positionlength- length- Returns:
 - memory segment
 
 
- 
updateSegment
@Nonnull public void updateSegment(DataSegment segment, long position, long length)
 
- 
updateSegmentLength
public void updateSegmentLength(DataSegment segment, long length)
 
- 
dropMemorySegment
public void dropMemorySegment(MemorySegment memorySegment)
 
- 
dropSegment
public void dropSegment(DataSegment segment)
 
- 
dropDocument
public void dropDocument(DeltaDocument document)
 
- 
setMemoryByte
public void setMemoryByte(MemorySegment memorySegment, long segmentPosition, byte value)
Sets byte to given segment. Handles shared memory between multiple segments.- Parameters:
 memorySegment- memory segmentsegmentPosition- relative position to segment startvalue- value to set
 
- 
insertMemoryData
public void insertMemoryData(MemorySegment memorySegment, long segmentPosition, org.exbin.auxiliary.paged_data.BinaryData insertedData)
 
- 
insertMemoryData
public void insertMemoryData(MemorySegment memorySegment, long segmentPosition, org.exbin.auxiliary.paged_data.BinaryData insertedData, long insertedDataOffset, long insertedDataLength)
 
- 
insertMemoryData
public void insertMemoryData(MemorySegment memorySegment, long segmentPosition, byte[] insertedData)
 
- 
insertMemoryData
public void insertMemoryData(MemorySegment memorySegment, long segmentPosition, byte[] insertedData, int insertedDataOffset, int insertedDataLength)
 
- 
insertMemoryData
public void insertMemoryData(MemorySegment memorySegment, long segmentPosition, long length)
 
- 
insertUninitializedMemoryData
public void insertUninitializedMemoryData(MemorySegment memorySegment, long segmentPosition, long length)
 
- 
detachMemoryArea
public void detachMemoryArea(MemorySegment memorySegment, long segmentPosition, long length)
Detaches all other memory segments crossing given area of provided memory segment.- Parameters:
 memorySegment- provided memory segmentsegmentPosition- positionlength- length
 
- 
detachSegment
public void detachSegment(MemorySegment memorySegment)
 
- 
copySegment
@Nonnull public DataSegment copySegment(DataSegment segment)
Creates copy of segment.- Parameters:
 segment- original segment- Returns:
 - copy of segment
 
 
- 
copySegment
@Nonnull public DataSegment copySegment(DataSegment segment, long offset, long length)
Creates copy of segment.- Parameters:
 segment- original segmentoffset- segment area offsetlength- segment area length- Returns:
 - copy of segment
 
 
- 
detachFileSource
public void detachFileSource(FileDataSource fileSource)
Loads all segments from given source file to memory.- Parameters:
 fileSource- file source
 
 - 
 
 -