forked from Qortal/qortal
Specify chunk size when splitting.
This commit is contained in:
parent
1613375cc0
commit
808b36e088
@ -110,7 +110,7 @@ public class DataResource {
|
||||
}
|
||||
LOGGER.info("Whole file digest: {}", dataFile.base58Digest());
|
||||
|
||||
int chunkCount = dataFile.split();
|
||||
int chunkCount = dataFile.split(DataFile.CHUNK_SIZE);
|
||||
if (chunkCount > 0) {
|
||||
LOGGER.info(String.format("Successfully split into %d chunk%s", chunkCount, (chunkCount == 1 ? "" : "s")));
|
||||
return "true";
|
||||
@ -146,7 +146,7 @@ public class DataResource {
|
||||
}
|
||||
LOGGER.info("Whole file digest: {}", dataFile.base58Digest());
|
||||
|
||||
int chunkCount = dataFile.split();
|
||||
int chunkCount = dataFile.split(DataFile.CHUNK_SIZE);
|
||||
if (chunkCount > 0) {
|
||||
LOGGER.info(String.format("Successfully split into %d chunk%s", chunkCount, (chunkCount == 1 ? "" : "s")));
|
||||
return "true";
|
||||
|
@ -170,10 +170,11 @@ public class DataFile {
|
||||
}
|
||||
|
||||
public int split() {
|
||||
public int split(int chunkSize) {
|
||||
try {
|
||||
|
||||
File file = this.getFile();
|
||||
byte[] buffer = new byte[CHUNK_SIZE];
|
||||
byte[] buffer = new byte[chunkSize];
|
||||
this.chunks = new ArrayList<>();
|
||||
|
||||
if (file != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user