Package org.exbin.auxiliary.paged_data
Interface EditableBinaryData
-
- All Superinterfaces:
BinaryData
- All Known Implementing Classes:
ByteArrayEditableData
,PagedData
@ParametersAreNonnullByDefault public interface EditableBinaryData extends BinaryData
Interface for editable binary data - sequence of bytes. Provides methods to read/write whole or part of the data to array or stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Removes all existing data.void
fillData(long startFrom, long length)
Fills given area with empty data.void
fillData(long startFrom, long length, byte fill)
Fills given area with bytes of given value.java.io.OutputStream
getDataOutputStream()
Provides handler for output stream generation.void
insert(long startFrom, byte[] insertedData)
Inserts given data to given position.void
insert(long startFrom, byte[] insertedData, int insertedDataOffset, int insertedDataLength)
Inserts given data to given position.void
insert(long startFrom, long length)
Inserts empty data of given length to given position.long
insert(long startFrom, java.io.InputStream inputStream, long maximumDataSize)
Loads data from given stream expecting provided size.void
insert(long startFrom, BinaryData insertedData)
Inserts given data to given position.void
insert(long startFrom, BinaryData insertedData, long insertedDataOffset, long insertedDataLength)
Inserts given data to given position.void
insertUninitialized(long startFrom, long length)
Inserts data space of given length to given position without setting any data to it.void
loadFromStream(java.io.InputStream inputStream)
Replaces all data by data red from given stream.void
remove(long startFrom, long length)
Removes area of data.void
replace(long targetPosition, byte[] replacingData)
Replaces data in given area with provided data.void
replace(long targetPosition, byte[] replacingData, int replacingDataOffset, int length)
Replaces data in given area with provided data.void
replace(long targetPosition, BinaryData replacingData)
Replaces data in given area with provided data.void
replace(long targetPosition, BinaryData replacingData, long startFrom, long length)
Replaces data in given area with provided data.void
setByte(long position, byte value)
Sets byte to given position.void
setDataSize(long size)
Sets data size.-
Methods inherited from interface org.exbin.auxiliary.paged_data.BinaryData
copy, copy, copyToArray, dispose, getByte, getDataInputStream, getDataSize, isEmpty, saveToStream
-
-
-
-
Method Detail
-
setDataSize
void setDataSize(long size)
Sets data size. If size is bigger than current size, it will fill it with zeros, otherwise it will shrink current data.- Parameters:
size
- target size
-
setByte
void setByte(long position, byte value)
Sets byte to given position.- Parameters:
position
- positionvalue
- byte value to be set
-
insertUninitialized
void insertUninitialized(long startFrom, long length)
Inserts data space of given length to given position without setting any data to it.- Parameters:
startFrom
- position to insert tolength
- length of data
-
insert
void insert(long startFrom, long length)
Inserts empty data of given length to given position.- Parameters:
startFrom
- position to insert tolength
- length of data
-
insert
void insert(long startFrom, byte[] insertedData)
Inserts given data to given position.- Parameters:
startFrom
- position to insert toinsertedData
- data to insert
-
insert
void insert(long startFrom, byte[] insertedData, int insertedDataOffset, int insertedDataLength)
Inserts given data to given position.- Parameters:
startFrom
- position to insert toinsertedData
- data to insertinsertedDataOffset
- inserted data offsetinsertedDataLength
- inserted data length
-
insert
void insert(long startFrom, BinaryData insertedData)
Inserts given data to given position.- Parameters:
startFrom
- position to insert toinsertedData
- data to insert
-
insert
void insert(long startFrom, BinaryData insertedData, long insertedDataOffset, long insertedDataLength)
Inserts given data to given position.- Parameters:
startFrom
- position to insert toinsertedData
- data to insertinsertedDataOffset
- inserted data offsetinsertedDataLength
- inserted data length
-
insert
long insert(long startFrom, java.io.InputStream inputStream, long maximumDataSize) throws java.io.IOException
Loads data from given stream expecting provided size. Preserves original data outside loaded range. Extends data if needed.- Parameters:
startFrom
- start position to insert datainputStream
- input streammaximumDataSize
- size of data to load or -1 for all data- Returns:
- length of loaded data
- Throws:
java.io.IOException
- if input/output error
-
replace
void replace(long targetPosition, BinaryData replacingData)
Replaces data in given area with provided data. If sourceData are the same instance, data are replaced as it would be copied to buffer first and replaced then.- Parameters:
targetPosition
- target position to write toreplacingData
- data to read from
-
replace
void replace(long targetPosition, BinaryData replacingData, long startFrom, long length)
Replaces data in given area with provided data. If sourceData are the same instance, data are replaced as it would be copied to buffer first and replaced then.- Parameters:
targetPosition
- target position to write toreplacingData
- data to read fromstartFrom
- position to start copy fromlength
- length of data to copy
-
replace
void replace(long targetPosition, byte[] replacingData)
Replaces data in given area with provided data. If sourceData are the same instance, data are replaced as it would be copied to buffer first and replaced then.- Parameters:
targetPosition
- target position to write toreplacingData
- data to read from
-
replace
void replace(long targetPosition, byte[] replacingData, int replacingDataOffset, int length)
Replaces data in given area with provided data. If sourceData are the same instance, data are replaced as it would be copied to buffer first and replaced then.- Parameters:
targetPosition
- target position to write toreplacingData
- data to read fromreplacingDataOffset
- position to start copy fromlength
- length of data to copy
-
fillData
void fillData(long startFrom, long length)
Fills given area with empty data.- Parameters:
startFrom
- position to fill data tolength
- length of area
-
fillData
void fillData(long startFrom, long length, byte fill)
Fills given area with bytes of given value.- Parameters:
startFrom
- position to fill data tolength
- length of areafill
- value to fill with
-
remove
void remove(long startFrom, long length)
Removes area of data.- Parameters:
startFrom
- position to start removal fromlength
- length of area
-
clear
void clear()
Removes all existing data. Simply releases all references to data pages.
-
loadFromStream
void loadFromStream(java.io.InputStream inputStream) throws java.io.IOException
Replaces all data by data red from given stream.- Parameters:
inputStream
- input stream- Throws:
java.io.IOException
- if input/output error
-
getDataOutputStream
@Nonnull java.io.OutputStream getDataOutputStream()
Provides handler for output stream generation. Received data are appended to existing data.- Returns:
- new instance of output stream
-
-