public class BinaryDownloader extends Object
| Constructor and Description |
|---|
BinaryDownloader(@NonNull OutputStream outputStream,
@NonNull UUID binaryTransferUUID)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
SiLABinaryTransfer.GetBinaryInfoRequest |
getBinaryInfoRequest()
Get binary info request
|
static int |
getChunkCount(long binarySize)
Get the number of chunk
|
static int |
getChunkSizeModulo(long binarySize)
Get chunk size
Size %
MAX_CHUNK_SIZE |
SiLABinaryTransfer.GetChunkRequest |
getNextChunkDownloadRequest(SiLABinaryTransfer.GetBinaryInfoResponse binaryInfo)
Get the next chunk download request
|
boolean |
isValidAndComplete() |
void |
isValidAndCompleteOrThrow() |
int |
writeChunk(SiLABinaryTransfer.GetChunkResponse chunkResponse)
Write chunk into
outputStream |
public BinaryDownloader(@NonNull
@NonNull OutputStream outputStream,
@NonNull
@NonNull UUID binaryTransferUUID)
outputStream - output stream to write chunks tobinaryTransferUUID - the binary transfer UUIDpublic SiLABinaryTransfer.GetChunkRequest getNextChunkDownloadRequest(@NonNull SiLABinaryTransfer.GetBinaryInfoResponse binaryInfo)
binaryInfo - the binary infopublic static int getChunkSizeModulo(long binarySize)
MAX_CHUNK_SIZEbinarySize - the binary size in bytespublic static int getChunkCount(long binarySize)
binarySize - the binary size in bytepublic int writeChunk(SiLABinaryTransfer.GetChunkResponse chunkResponse) throws IOException
outputStreamchunkResponse - the chunk responseIOException - if enable to writepublic boolean isValidAndComplete()
public void isValidAndCompleteOrThrow()
public SiLABinaryTransfer.GetBinaryInfoRequest getBinaryInfoRequest()
SiLABinaryTransfer.GetBinaryInfoRequestCopyright © 2024 SiLA Java Developers. All rights reserved.