- All Known Implementing Classes:
FileData
,MemoryData
interface Data
-
Method Summary
Modifier and TypeMethodDescriptioncreateNext
(DataHead dataHead, ByteBuffer buf) Factory method to create a Data.byte[]
read()
TODO: should the return type be ByteBuffer ?? Return part's partial data.int
size()
size of the chunk given by the parserlong
Write this partial data to a file
-
Method Details
-
size
int size()size of the chunk given by the parser- Returns:
- size of the chunk
-
read
byte[] read()TODO: should the return type be ByteBuffer ?? Return part's partial data. The data is read only.- Returns:
- a byte array which contains {#size()} bytes. The returned array may be larger than {#size()} bytes and contains data from offset 0.
-
writeTo
Write this partial data to a file- Parameters:
file
- to which the data needs to be written- Returns:
- file pointer before the write operation(at which the data is written from)
-
createNext
Factory method to create a Data. The implementation could be file based one or memory based one.- Parameters:
dataHead
- start of the linked list of data objectsbuf
- contains partial content for a part- Returns:
- Data
-