public class FileReceiver extends Object
Protocol is to receive a file-create
followed by 1 or more file-chunk
messages that are all
linked via the correlation id. Messages are encoded in ByteOrder.LITTLE_ENDIAN
.
The chunk size if best determined by Publication.maxPayloadLength()
minus header for the chunk.
file-create
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version | +---------------------------------------------------------------+ | Message Type = 1 | +---------------------------------------------------------------+ | Correlation ID | | | +---------------------------------------------------------------+ | File Length | | | +---------------------------------------------------------------+ | File Name Length | +---------------------------------------------------------------+ | File Name ... ... | +---------------------------------------------------------------+file-chunk
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version | +---------------------------------------------------------------+ | Message Type = 2 | +---------------------------------------------------------------+ | Correlation ID | | | +---------------------------------------------------------------+ | Chunk Offset | | | +---------------------------------------------------------------+ | Chunk Length | | | +---------------------------------------------------------------+ | Chunk Payload ... ... | +---------------------------------------------------------------+* @see FileSender
Modifier and Type | Field and Description |
---|---|
static int |
CHUNK_LENGTH_OFFSET |
static int |
CHUNK_OFFSET_OFFSET |
static int |
CHUNK_PAYLOAD_OFFSET |
static int |
CORRELATION_ID_OFFSET |
static int |
FILE_CHUNK_TYPE |
static int |
FILE_CREATE_TYPE |
static int |
FILE_LENGTH_OFFSET |
static int |
FILE_NAME_OFFSET |
static int |
TYPE_OFFSET |
static int |
VERSION |
static int |
VERSION_OFFSET |
Constructor and Description |
---|
FileReceiver(File storageDir,
Subscription subscription) |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
void |
onFragment(DirectBuffer buffer,
int offset,
int length,
Header header) |
public static final int VERSION
public static final int FILE_CREATE_TYPE
public static final int FILE_CHUNK_TYPE
public static final int VERSION_OFFSET
public static final int TYPE_OFFSET
public static final int CORRELATION_ID_OFFSET
public static final int FILE_LENGTH_OFFSET
public static final int FILE_NAME_OFFSET
public static final int CHUNK_OFFSET_OFFSET
public static final int CHUNK_LENGTH_OFFSET
public static final int CHUNK_PAYLOAD_OFFSET
public FileReceiver(File storageDir, Subscription subscription)
public static void main(String[] args)
public void onFragment(DirectBuffer buffer, int offset, int length, Header header)
Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.