Package org.exbin.auxiliary.paged_data
Interface BinaryData
-
- All Known Subinterfaces:
EditableBinaryData
- All Known Implementing Classes:
ByteArrayData,ByteArrayEditableData,PagedData
@ParametersAreNonnullByDefault public interface BinaryDataInterface for binary data - read-only sequence of bytes. Provides methods to read whole or part of the data to array or stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BinaryDatacopy()Creates copy of all data.BinaryDatacopy(long startFrom, long length)Creates copy of given area.voidcopyToArray(long startFrom, byte[] target, int offset, int length)Creates copy of given area into array of bytes.voiddispose()Disposes all allocated data if possible.bytegetByte(long position)Returns particular byte from data.java.io.InputStreamgetDataInputStream()Provides handler for input stream generation.longgetDataSize()Returns size of data or -1 if size is not available.booleanisEmpty()Returns true if data are empty.voidsaveToStream(java.io.OutputStream outputStream)Saves/copies all data to given stream.
-
-
-
Method Detail
-
isEmpty
boolean isEmpty()
Returns true if data are empty.- Returns:
- true if data empty
-
getDataSize
long getDataSize()
Returns size of data or -1 if size is not available.- Returns:
- size of data in bytes
-
getByte
byte getByte(long position)
Returns particular byte from data.- Parameters:
position- position- Returns:
- byte on requested position
-
copy
@Nonnull BinaryData copy()
Creates copy of all data.- Returns:
- copy of data
-
copy
@Nonnull BinaryData copy(long startFrom, long length)
Creates copy of given area.- Parameters:
startFrom- position to start copy fromlength- length of area- Returns:
- copy of data
-
copyToArray
void copyToArray(long startFrom, byte[] target, int offset, int length)Creates copy of given area into array of bytes.- Parameters:
startFrom- position to start copy fromtarget- target byte arrayoffset- offset position in targetlength- length of area to copy
-
saveToStream
void saveToStream(java.io.OutputStream outputStream) throws java.io.IOExceptionSaves/copies all data to given stream.- Parameters:
outputStream- output stream- Throws:
java.io.IOException- if input/output error
-
getDataInputStream
@Nonnull java.io.InputStream getDataInputStream()
Provides handler for input stream generation.- Returns:
- new instance of input stream
-
dispose
void dispose()
Disposes all allocated data if possible.
-
-