1
1
/*
2
- * Copyright 2016-2022 DiffPlug
2
+ * Copyright 2016-2023 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ final class RomeExecutableDownloader {
68
68
* {@link OpenOption Open options} for reading an existing file without write
69
69
* access.
70
70
*/
71
- private static final OpenOption [] READ_OPTIONS = { StandardOpenOption .READ };
71
+ private static final OpenOption [] READ_OPTIONS = {StandardOpenOption .READ };
72
72
73
73
/**
74
74
* The pattern for {@link String#format(String, Object...) String.format()} for
@@ -81,15 +81,15 @@ final class RomeExecutableDownloader {
81
81
* {@link OpenOption Open options} for creating a new file, overwriting the
82
82
* existing file if present.
83
83
*/
84
- private static final OpenOption [] WRITE_OPTIONS = { StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING ,
85
- StandardOpenOption .WRITE };
84
+ private static final OpenOption [] WRITE_OPTIONS = {StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING ,
85
+ StandardOpenOption .WRITE };
86
86
87
87
private Path downloadDir ;
88
88
89
89
/**
90
90
* Creates a new downloader for the Rome executable. The executable files are
91
91
* stored in the given download directory.
92
- *
92
+ *
93
93
* @param downloadDir Directory where
94
94
*/
95
95
public RomeExecutableDownloader (Path downloadDir ) {
@@ -100,7 +100,7 @@ public RomeExecutableDownloader(Path downloadDir) {
100
100
* Downloads the Rome executable for the current platform from the network to
101
101
* the download directory. When the executable exists already, it is
102
102
* overwritten.
103
- *
103
+ *
104
104
* @param version Desired Rome version.
105
105
* @return The path to the Rome executable.
106
106
* @throws IOException When the executable cannot be downloaded from
@@ -140,7 +140,7 @@ public Path download(String version) throws IOException, InterruptedException {
140
140
* directory, an attempt is made to download the Rome executable from the
141
141
* network. When the executable exists already, no attempt to download it again
142
142
* is made.
143
- *
143
+ *
144
144
* @param version Desired Rome version.
145
145
* @return The path to the Rome executable.
146
146
* @throws IOException When the executable cannot be downloaded from
@@ -168,7 +168,7 @@ public Path ensureDownloaded(String version) throws IOException, InterruptedExce
168
168
/**
169
169
* Attempts to find the Rome executable for the current platform in the download
170
170
* directory. No attempt is made to download the executable from the network.
171
- *
171
+ *
172
172
* @param version Desired Rome version.
173
173
* @return The path to the Rome executable.
174
174
* @throws IOException When the executable does not exists in the
@@ -188,7 +188,7 @@ public Optional<Path> findDownloaded(String version) throws IOException {
188
188
/**
189
189
* Checks whether the given file exists and matches the checksum. The checksum
190
190
* must be contained in a file next to the file to check.
191
- *
191
+ *
192
192
* @param filePath File to check.
193
193
* @return <code>true</code> if the file exists and matches the checksum,
194
194
* <code>false</code> otherwise.
@@ -223,7 +223,7 @@ private boolean checkFileWithChecksum(Path filePath) {
223
223
224
224
/**
225
225
* Computes the checksum of the given file.
226
- *
226
+ *
227
227
* @param file File to process.
228
228
* @param algorithm The checksum algorithm to use.
229
229
* @return The MD5 checksum of the given file.
@@ -247,7 +247,7 @@ private String computeChecksum(Path file, String algorithm) throws IOException {
247
247
/**
248
248
* Finds the code name for the given operating system used by the Rome
249
249
* executable download URL.
250
- *
250
+ *
251
251
* @param os Desired operating system.
252
252
* @return Code name for the Rome download URL.
253
253
* @throws IOException When the given OS is not supported by Rome.
@@ -265,7 +265,7 @@ private String getArchitectureCodeName(Architecture architecture) throws IOExcep
265
265
266
266
/**
267
267
* Derives a path for the file which contains the checksum of the given file.
268
- *
268
+ *
269
269
* @param file A file for which to derive the checksum file path.
270
270
* @return The path with the checksum for the given file.
271
271
*/
@@ -275,7 +275,7 @@ private Path getChecksumPath(Path file) {
275
275
276
276
/**
277
277
* Finds the URL from which the Rome executable can be downloaded.
278
- *
278
+ *
279
279
* @param version Desired Rome version.
280
280
* @param platform Desired platform.
281
281
* @return The URL for the Rome executable.
@@ -292,7 +292,7 @@ private String getDownloadUrl(String version, Platform platform) throws IOExcept
292
292
/**
293
293
* Finds the file extension of the Rome download URL for the given operating
294
294
* system.
295
- *
295
+ *
296
296
* @param os Desired operating system.
297
297
* @return Extension for the Rome download URL.
298
298
* @throws IOException When the given OS is not supported by Rome.
@@ -313,7 +313,7 @@ private String getDownloadUrlExtension(OS os) throws IOException {
313
313
/**
314
314
* Finds the path on the file system for the Rome executable with a given
315
315
* version and platform.
316
- *
316
+ *
317
317
* @param version Desired Rome version.
318
318
* @param platform Desired platform.
319
319
* @return The path for the Rome executable.
@@ -328,7 +328,7 @@ private Path getExecutablePath(String version, Platform platform) {
328
328
/**
329
329
* Finds the code name for the given operating system used by the Rome
330
330
* executable download URL.
331
- *
331
+ *
332
332
* @param os Desired operating system.
333
333
* @return Code name for the Rome download URL.
334
334
* @throws IOException When the given OS is not supported by Rome.
@@ -348,7 +348,7 @@ private String getOsCodeName(OS os) throws IOException {
348
348
349
349
/**
350
350
* Reads a plain text file with the given encoding into a string.
351
- *
351
+ *
352
352
* @param file File to read.
353
353
* @param charset Encoding to use.
354
354
* @return The contents of the file as a string.
@@ -363,7 +363,7 @@ private String readTextFile(Path file, Charset charset) throws IOException {
363
363
/**
364
364
* Computes the checksum of the given file and writes it to the target checksum
365
365
* file, using the {@code ISO_8859_1} encoding.
366
- *
366
+ *
367
367
* @param file
368
368
* @param checksumPath
369
369
* @throws IOException
0 commit comments