Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Increase byte buffer to 8kb. Resolves #65
Browse files Browse the repository at this point in the history
  • Loading branch information
mordechai committed Apr 11, 2019
1 parent 5edc494 commit 8cf0f5e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
@@ -1,4 +1,6 @@
* *Upcoming Release* * *Upcoming Release*
* Increased download byte buffer to 8kb *— suggested by [@ChristianCiach](https://github.com/ChristianCiach)*
* **1.4.1**
* Allow 2 files with same path in config if both target different operating systems. * Allow 2 files with same path in config if both target different operating systems.
* Added `UpdateHandler.shouldCheckForUpdate()`. Returning `false` will skip that file from being updated. * Added `UpdateHandler.shouldCheckForUpdate()`. Returning `false` will skip that file from being updated.
* Pass arguments and system properties from the config when using the `DefaultLauncher`. * Pass arguments and system properties from the config when using the `DefaultLauncher`.
Expand All @@ -23,7 +25,7 @@
* Renamed `UpdateHandler::connect` to `UpdateHandler::openDownloadStream` * Renamed `UpdateHandler::connect` to `UpdateHandler::openDownloadStream`
* Added more `Configuration.Builder::signer` overloads. * Added more `Configuration.Builder::signer` overloads.
* Default bootstrap now deletes old files if `--syncLocal` was used. * Default bootstrap now deletes old files if `--syncLocal` was used.
* **1.3.2** *h/t [@ChristianCiach](https://github.com/ChristianCiach)* * **1.3.2** *Tested on Linux by [@ChristianCiach](https://github.com/ChristianCiach)*
* Control how files are downloaded with `UpdateHandler::connect`. * Control how files are downloaded with `UpdateHandler::connect`.
* Delete old files with `Configuration::deleteOldFiles`. * Delete old files with `Configuration::deleteOldFiles`.
* **1.3.1** * **1.3.1**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/update4j/ConfigImpl.java
Expand Up @@ -124,7 +124,7 @@ static boolean doUpdate(Configuration config, Path tempDir, PublicKey key, Injec


int read = 0; int read = 0;
double currentCompleted = 0; double currentCompleted = 0;
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024 * 8];


Path output; Path output;
if (!updateTemp) { if (!updateTemp) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/update4j/util/FileUtils.java
Expand Up @@ -51,7 +51,7 @@ private FileUtils() {
public static long getChecksum(Path path) throws IOException { public static long getChecksum(Path path) throws IOException {
try (InputStream input = Files.newInputStream(path)) { try (InputStream input = Files.newInputStream(path)) {
Adler32 checksum = new Adler32(); Adler32 checksum = new Adler32();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024 * 8];


int read; int read;
while ((read = input.read(buf, 0, buf.length)) > -1) while ((read = input.read(buf, 0, buf.length)) > -1)
Expand Down Expand Up @@ -98,7 +98,7 @@ public static byte[] sign(Path path, PrivateKey key) throws IOException {
sign.initSign(key); sign.initSign(key);


try (InputStream input = Files.newInputStream(path)) { try (InputStream input = Files.newInputStream(path)) {
byte[] buf = new byte[1024]; byte[] buf = new byte[1024 * 8];
int len; int len;
while ((len = input.read(buf, 0, buf.length)) > 0) while ((len = input.read(buf, 0, buf.length)) > 0)
sign.update(buf, 0, len); sign.update(buf, 0, len);
Expand Down

0 comments on commit 8cf0f5e

Please sign in to comment.