Gintarus

filu

Jul 6th, 2025
20
0
Never
6
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.37 KB | None | 0 0
  1. /* Decompiler 766ms, total 947ms, lines 1342 */
  2. package org.apache.commons.io;
  3.  
  4. import java.io.BufferedOutputStream;
  5. import java.io.File;
  6. import java.io.FileFilter;
  7. import java.io.FileInputStream;
  8. import java.io.FileNotFoundException;
  9. import java.io.FileOutputStream;
  10. import java.io.IOException;
  11. import java.io.InputStream;
  12. import java.io.InputStreamReader;
  13. import java.io.OutputStream;
  14. import java.io.Reader;
  15. import java.math.BigInteger;
  16. import java.net.URL;
  17. import java.net.URLConnection;
  18. import java.nio.ByteBuffer;
  19. import java.nio.channels.FileChannel;
  20. import java.nio.charset.Charset;
  21. import java.util.ArrayList;
  22. import java.util.Collection;
  23. import java.util.Date;
  24. import java.util.Iterator;
  25. import java.util.LinkedList;
  26. import java.util.List;
  27. import java.util.zip.CRC32;
  28. import java.util.zip.CheckedInputStream;
  29. import java.util.zip.Checksum;
  30. import org.apache.commons.io.filefilter.DirectoryFileFilter;
  31. import org.apache.commons.io.filefilter.FalseFileFilter;
  32. import org.apache.commons.io.filefilter.FileFilterUtils;
  33. import org.apache.commons.io.filefilter.IOFileFilter;
  34. import org.apache.commons.io.filefilter.SuffixFileFilter;
  35. import org.apache.commons.io.filefilter.TrueFileFilter;
  36. import org.apache.commons.io.output.NullOutputStream;
  37.  
  38. public class FileUtils {
  39. public static final long ONE_KB = 1024L;
  40. public static final BigInteger ONE_KB_BI = BigInteger.valueOf(1024L);
  41. public static final long ONE_MB = 1048576L;
  42. public static final BigInteger ONE_MB_BI;
  43. private static final long FILE_COPY_BUFFER_SIZE = 31457280L;
  44. public static final long ONE_GB = 1073741824L;
  45. public static final BigInteger ONE_GB_BI;
  46. public static final long ONE_TB = 1099511627776L;
  47. public static final BigInteger ONE_TB_BI;
  48. public static final long ONE_PB = 1125899906842624L;
  49. public static final BigInteger ONE_PB_BI;
  50. public static final long ONE_EB = 1152921504606846976L;
  51. public static final BigInteger ONE_EB_BI;
  52. public static final BigInteger ONE_ZB;
  53. public static final BigInteger ONE_YB;
  54. public static final File[] EMPTY_FILE_ARRAY;
  55. private static final Charset UTF8;
  56.  
  57. public static File getFile(File directory, String... names) {
  58. if (directory == null) {
  59. throw new NullPointerException("directorydirectory must not be null");
  60. } else if (names == null) {
  61. throw new NullPointerException("names must not be null");
  62. } else {
  63. File file = directory;
  64. String[] arr$ = names;
  65. int len$ = names.length;
  66.  
  67. for(int i$ = 0; i$ < len$; ++i$) {
  68. String name = arr$[i$];
  69. file = new File(file, name);
  70. }
  71.  
  72. return file;
  73. }
  74. }
  75.  
  76. public static File getFile(String... names) {
  77. if (names == null) {
  78. throw new NullPointerException("names must not be null");
  79. } else {
  80. File file = null;
  81. String[] arr$ = names;
  82. int len$ = names.length;
  83.  
  84. for(int i$ = 0; i$ < len$; ++i$) {
  85. String name = arr$[i$];
  86. if (file == null) {
  87. file = new File(name);
  88. } else {
  89. file = new File(file, name);
  90. }
  91. }
  92.  
  93. return file;
  94. }
  95. }
  96.  
  97. public static String getTempDirectoryPath() {
  98. return System.getProperty("java.io.tmpdir");
  99. }
  100.  
  101. public static File getTempDirectory() {
  102. return new File(getTempDirectoryPath());
  103. }
  104.  
  105. public static String getUserDirectoryPath() {
  106. return System.getProperty("user.home");
  107. }
  108.  
  109. public static File getUserDirectory() {
  110. return new File(getUserDirectoryPath());
  111. }
  112.  
  113. public static FileInputStream openInputStream(File file) throws IOException {
  114. if (file.exists()) {
  115. if (file.isDirectory()) {
  116. throw new IOException("File '" + file + "' exists but is a directory");
  117. } else if (!file.canRead()) {
  118. throw new IOException("File '" + file + "' cannot be read");
  119. } else {
  120. return new FileInputStream(file);
  121. }
  122. } else {
  123. throw new FileNotFoundException("File '" + file + "' does not exist");
  124. }
  125. }
  126.  
  127. public static FileOutputStream openOutputStream(File file) throws IOException {
  128. return openOutputStream(file, false);
  129. }
  130.  
  131. public static FileOutputStream openOutputStream(File file, boolean append) throws IOException {
  132. if (file.exists()) {
  133. if (file.isDirectory()) {
  134. throw new IOException("File '" + file + "' exists but is a directory");
  135. }
  136.  
  137. if (!file.canWrite()) {
  138. throw new IOException("File '" + file + "' cannot be written to");
  139. }
  140. } else {
  141. File parent = file.getParentFile();
  142. if (parent != null && !parent.mkdirs() && !parent.isDirectory()) {
  143. throw new IOException("Directory '" + parent + "' could not be created");
  144. }
  145. }
  146.  
  147. return new FileOutputStream(file, append);
  148. }
  149.  
  150. public static String byteCountToDisplaySize(BigInteger size) {
  151. String displaySize;
  152. if (size.divide(ONE_EB_BI).compareTo(BigInteger.ZERO) > 0) {
  153. displaySize = size.divide(ONE_EB_BI) + " EB";
  154. } else if (size.divide(ONE_PB_BI).compareTo(BigInteger.ZERO) > 0) {
  155. displaySize = size.divide(ONE_PB_BI) + " PB";
  156. } else if (size.divide(ONE_TB_BI).compareTo(BigInteger.ZERO) > 0) {
  157. displaySize = size.divide(ONE_TB_BI) + " TB";
  158. } else if (size.divide(ONE_GB_BI).compareTo(BigInteger.ZERO) > 0) {
  159. displaySize = size.divide(ONE_GB_BI) + " GB";
  160. } else if (size.divide(ONE_MB_BI).compareTo(BigInteger.ZERO) > 0) {
  161. displaySize = size.divide(ONE_MB_BI) + " MB";
  162. } else if (size.divide(ONE_KB_BI).compareTo(BigInteger.ZERO) > 0) {
  163. displaySize = size.divide(ONE_KB_BI) + " KB";
  164. } else {
  165. displaySize = size + " bytes";
  166. }
  167.  
  168. return displaySize;
  169. }
  170.  
  171. public static String byteCountToDisplaySize(long size) {
  172. return byteCountToDisplaySize(BigInteger.valueOf(size));
  173. }
  174.  
  175. public static void touch(File file) throws IOException {
  176. if (!file.exists()) {
  177. OutputStream out = openOutputStream(file);
  178. IOUtils.closeQuietly(out);
  179. }
  180.  
  181. boolean success = file.setLastModified(System.currentTimeMillis());
  182. if (!success) {
  183. throw new IOException("Unable to set the last modification time for " + file);
  184. }
  185. }
  186.  
  187. public static File[] convertFileCollectionToFileArray(Collection<File> files) {
  188. return (File[])files.toArray(new File[files.size()]);
  189. }
  190.  
  191. private static void innerListFiles(Collection<File> files, File directory, IOFileFilter filter, boolean includeSubDirectories) {
  192. File[] found = directory.listFiles(filter);
  193. if (found != null) {
  194. File[] arr$ = found;
  195. int len$ = found.length;
  196.  
  197. for(int i$ = 0; i$ < len$; ++i$) {
  198. File file = arr$[i$];
  199. if (file.isDirectory()) {
  200. if (includeSubDirectories) {
  201. files.add(file);
  202. }
  203.  
  204. innerListFiles(files, file, filter, includeSubDirectories);
  205. } else {
  206. files.add(file);
  207. }
  208. }
  209. }
  210.  
  211. }
  212.  
  213. public static Collection<File> listFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
  214. validateListFilesParameters(directory, fileFilter);
  215. IOFileFilter effFileFilter = setUpEffectiveFileFilter(fileFilter);
  216. IOFileFilter effDirFilter = setUpEffectiveDirFilter(dirFilter);
  217. Collection<File> files = new LinkedList();
  218. innerListFiles(files, directory, FileFilterUtils.or(new IOFileFilter[]{effFileFilter, effDirFilter}), false);
  219. return files;
  220. }
  221.  
  222. private static void validateListFilesParameters(File directory, IOFileFilter fileFilter) {
  223. if (!directory.isDirectory()) {
  224. throw new IllegalArgumentException("Parameter 'directory' is not a directory");
  225. } else if (fileFilter == null) {
  226. throw new NullPointerException("Parameter 'fileFilter' is null");
  227. }
  228. }
  229.  
  230. private static IOFileFilter setUpEffectiveFileFilter(IOFileFilter fileFilter) {
  231. return FileFilterUtils.and(new IOFileFilter[]{fileFilter, FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE)});
  232. }
  233.  
  234. private static IOFileFilter setUpEffectiveDirFilter(IOFileFilter dirFilter) {
  235. return dirFilter == null ? FalseFileFilter.INSTANCE : FileFilterUtils.and(new IOFileFilter[]{dirFilter, DirectoryFileFilter.INSTANCE});
  236. }
  237.  
  238. public static Collection<File> listFilesAndDirs(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
  239. validateListFilesParameters(directory, fileFilter);
  240. IOFileFilter effFileFilter = setUpEffectiveFileFilter(fileFilter);
  241. IOFileFilter effDirFilter = setUpEffectiveDirFilter(dirFilter);
  242. Collection<File> files = new LinkedList();
  243. if (directory.isDirectory()) {
  244. files.add(directory);
  245. }
  246.  
  247. innerListFiles(files, directory, FileFilterUtils.or(new IOFileFilter[]{effFileFilter, effDirFilter}), true);
  248. return files;
  249. }
  250.  
  251. public static Iterator<File> iterateFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
  252. return listFiles(directory, fileFilter, dirFilter).iterator();
  253. }
  254.  
  255. public static Iterator<File> iterateFilesAndDirs(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
  256. return listFilesAndDirs(directory, fileFilter, dirFilter).iterator();
  257. }
  258.  
  259. private static String[] toSuffixes(String[] extensions) {
  260. String[] suffixes = new String[extensions.length];
  261.  
  262. for(int i = 0; i < extensions.length; ++i) {
  263. suffixes[i] = "." + extensions[i];
  264. }
  265.  
  266. return suffixes;
  267. }
  268.  
  269. public static Collection<File> listFiles(File directory, String[] extensions, boolean recursive) {
  270. Object filter;
  271. if (extensions == null) {
  272. filter = TrueFileFilter.INSTANCE;
  273. } else {
  274. String[] suffixes = toSuffixes(extensions);
  275. filter = new SuffixFileFilter(suffixes);
  276. }
  277.  
  278. return listFiles(directory, (IOFileFilter)filter, recursive ? TrueFileFilter.INSTANCE : FalseFileFilter.INSTANCE);
  279. }
  280.  
  281. public static Iterator<File> iterateFiles(File directory, String[] extensions, boolean recursive) {
  282. return listFiles(directory, extensions, recursive).iterator();
  283. }
  284.  
  285. public static boolean contentEquals(File file1, File file2) throws IOException {
  286. boolean file1Exists = file1.exists();
  287. if (file1Exists != file2.exists()) {
  288. return false;
  289. } else if (!file1Exists) {
  290. return true;
  291. } else if (!file1.isDirectory() && !file2.isDirectory()) {
  292. if (file1.length() != file2.length()) {
  293. return false;
  294. } else if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) {
  295. return true;
  296. } else {
  297. InputStream input1 = null;
  298. FileInputStream input2 = null;
  299.  
  300. boolean var5;
  301. try {
  302. input1 = new FileInputStream(file1);
  303. input2 = new FileInputStream(file2);
  304. var5 = IOUtils.contentEquals(input1, input2);
  305. } finally {
  306. IOUtils.closeQuietly(input1);
  307. IOUtils.closeQuietly(input2);
  308. }
  309.  
  310. return var5;
  311. }
  312. } else {
  313. throw new IOException("Can't compare directories, only files");
  314. }
  315. }
  316.  
  317. public static boolean contentEqualsIgnoreEOL(File file1, File file2, String charsetName) throws IOException {
  318. boolean file1Exists = file1.exists();
  319. if (file1Exists != file2.exists()) {
  320. return false;
  321. } else if (!file1Exists) {
  322. return true;
  323. } else if (!file1.isDirectory() && !file2.isDirectory()) {
  324. if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) {
  325. return true;
  326. } else {
  327. Reader input1 = null;
  328. InputStreamReader input2 = null;
  329.  
  330. boolean var6;
  331. try {
  332. if (charsetName == null) {
  333. input1 = new InputStreamReader(new FileInputStream(file1));
  334. input2 = new InputStreamReader(new FileInputStream(file2));
  335. } else {
  336. input1 = new InputStreamReader(new FileInputStream(file1), charsetName);
  337. input2 = new InputStreamReader(new FileInputStream(file2), charsetName);
  338. }
  339.  
  340. var6 = IOUtils.contentEqualsIgnoreEOL(input1, input2);
  341. } finally {
  342. IOUtils.closeQuietly(input1);
  343. IOUtils.closeQuietly(input2);
  344. }
  345.  
  346. return var6;
  347. }
  348. } else {
  349. throw new IOException("Can't compare directories, only files");
  350. }
  351. }
  352.  
  353. public static File toFile(URL url) {
  354. if (url != null && "file".equalsIgnoreCase(url.getProtocol())) {
  355. String filename = url.getFile().replace('/', File.separatorChar);
  356. filename = decodeUrl(filename);
  357. return new File(filename);
  358. } else {
  359. return null;
  360. }
  361. }
  362.  
  363. static String decodeUrl(String url) {
  364. String decoded = url;
  365. if (url != null && url.indexOf(37) >= 0) {
  366. int n = url.length();
  367. StringBuffer buffer = new StringBuffer();
  368. ByteBuffer bytes = ByteBuffer.allocate(n);
  369. int i = 0;
  370.  
  371. while(true) {
  372. while(true) {
  373. if (i >= n) {
  374. decoded = buffer.toString();
  375. return decoded;
  376. }
  377.  
  378. if (url.charAt(i) != '%') {
  379. break;
  380. }
  381.  
  382. try {
  383. while(true) {
  384. byte octet = (byte)Integer.parseInt(url.substring(i + 1, i + 3), 16);
  385. bytes.put(octet);
  386. i += 3;
  387. if (i >= n || url.charAt(i) != '%') {
  388. break;
  389. }
  390. }
  391. } catch (RuntimeException var10) {
  392. break;
  393. } finally {
  394. if (bytes.position() > 0) {
  395. bytes.flip();
  396. buffer.append(UTF8.decode(bytes).toString());
  397. bytes.clear();
  398. }
  399.  
  400. }
  401. }
  402.  
  403. buffer.append(url.charAt(i++));
  404. }
  405. } else {
  406. return decoded;
  407. }
  408. }
  409.  
  410. public static File[] toFiles(URL[] urls) {
  411. if (urls != null && urls.length != 0) {
  412. File[] files = new File[urls.length];
  413.  
  414. for(int i = 0; i < urls.length; ++i) {
  415. URL url = urls[i];
  416. if (url != null) {
  417. if (!url.getProtocol().equals("file")) {
  418. throw new IllegalArgumentException("URL could not be converted to a File: " + url);
  419. }
  420.  
  421. files[i] = toFile(url);
  422. }
  423. }
  424.  
  425. return files;
  426. } else {
  427. return EMPTY_FILE_ARRAY;
  428. }
  429. }
  430.  
  431. public static URL[] toURLs(File[] files) throws IOException {
  432. URL[] urls = new URL[files.length];
  433.  
  434. for(int i = 0; i < urls.length; ++i) {
  435. urls[i] = files[i].toURI().toURL();
  436. }
  437.  
  438. return urls;
  439. }
  440.  
  441. public static void copyFileToDirectory(File srcFile, File destDir) throws IOException {
  442. copyFileToDirectory(srcFile, destDir, true);
  443. }
  444.  
  445. public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
  446. if (destDir == null) {
  447. throw new NullPointerException("Destination must not be null");
  448. } else if (destDir.exists() && !destDir.isDirectory()) {
  449. throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
  450. } else {
  451. File destFile = new File(destDir, srcFile.getName());
  452. copyFile(srcFile, destFile, preserveFileDate);
  453. }
  454. }
  455.  
  456. public static void copyFile(File srcFile, File destFile) throws IOException {
  457. copyFile(srcFile, destFile, true);
  458. }
  459.  
  460. public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
  461. if (srcFile == null) {
  462. throw new NullPointerException("Source must not be null");
  463. } else if (destFile == null) {
  464. throw new NullPointerException("Destination must not be null");
  465. } else if (!srcFile.exists()) {
  466. throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
  467. } else if (srcFile.isDirectory()) {
  468. throw new IOException("Source '" + srcFile + "' exists but is a directory");
  469. } else if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) {
  470. throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same");
  471. } else {
  472. File parentFile = destFile.getParentFile();
  473. if (parentFile != null && !parentFile.mkdirs() && !parentFile.isDirectory()) {
  474. throw new IOException("Destination '" + parentFile + "' directory cannot be created");
  475. } else if (destFile.exists() && !destFile.canWrite()) {
  476. throw new IOException("Destination '" + destFile + "' exists but is read-only");
  477. } else {
  478. doCopyFile(srcFile, destFile, preserveFileDate);
  479. }
  480. }
  481. }
  482.  
  483. public static long copyFile(File input, OutputStream output) throws IOException {
  484. FileInputStream fis = new FileInputStream(input);
  485.  
  486. long var3;
  487. try {
  488. var3 = IOUtils.copyLarge(fis, output);
  489. } finally {
  490. fis.close();
  491. }
  492.  
  493. return var3;
  494. }
  495.  
  496. private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
  497. if (destFile.exists() && destFile.isDirectory()) {
  498. throw new IOException("Destination '" + destFile + "' exists but is a directory");
  499. } else {
  500. FileInputStream fis = null;
  501. FileOutputStream fos = null;
  502. FileChannel input = null;
  503. FileChannel output = null;
  504.  
  505. try {
  506. fis = new FileInputStream(srcFile);
  507. fos = new FileOutputStream(destFile);
  508. input = fis.getChannel();
  509. output = fos.getChannel();
  510. long size = input.size();
  511. long pos = 0L;
  512.  
  513. for(long count = 0L; pos < size; pos += output.transferFrom(input, pos, count)) {
  514. count = size - pos > 31457280L ? 31457280L : size - pos;
  515. }
  516. } finally {
  517. IOUtils.closeQuietly(output);
  518. IOUtils.closeQuietly(fos);
  519. IOUtils.closeQuietly(input);
  520. IOUtils.closeQuietly(fis);
  521. }
  522.  
  523. if (srcFile.length() != destFile.length()) {
  524. throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
  525. } else {
  526. if (preserveFileDate) {
  527. destFile.setLastModified(srcFile.lastModified());
  528. }
  529.  
  530. }
  531. }
  532. }
  533.  
  534. public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException {
  535. if (srcDir == null) {
  536. throw new NullPointerException("Source must not be null");
  537. } else if (srcDir.exists() && !srcDir.isDirectory()) {
  538. throw new IllegalArgumentException("Source '" + destDir + "' is not a directory");
  539. } else if (destDir == null) {
  540. throw new NullPointerException("Destination must not be null");
  541. } else if (destDir.exists() && !destDir.isDirectory()) {
  542. throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
  543. } else {
  544. copyDirectory(srcDir, new File(destDir, srcDir.getName()), true);
  545. }
  546. }
  547.  
  548. public static void copyDirectory(File srcDir, File destDir) throws IOException {
  549. copyDirectory(srcDir, destDir, true);
  550. }
  551.  
  552. public static void copyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
  553. copyDirectory(srcDir, destDir, (FileFilter)null, preserveFileDate);
  554. }
  555.  
  556. public static void copyDirectory(File srcDir, File destDir, FileFilter filter) throws IOException {
  557. copyDirectory(srcDir, destDir, filter, true);
  558. }
  559.  
  560. public static void copyDirectory(File srcDir, File destDir, FileFilter filter, boolean preserveFileDate) throws IOException {
  561. if (srcDir == null) {
  562. throw new NullPointerException("Source must not be null");
  563. } else if (destDir == null) {
  564. throw new NullPointerException("Destination must not be null");
  565. } else if (!srcDir.exists()) {
  566. throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
  567. } else if (!srcDir.isDirectory()) {
  568. throw new IOException("Source '" + srcDir + "' exists but is not a directory");
  569. } else if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) {
  570. throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same");
  571. } else {
  572. List<String> exclusionList = null;
  573. if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
  574. File[] srcFiles = filter == null ? srcDir.listFiles() : srcDir.listFiles(filter);
  575. if (srcFiles != null && srcFiles.length > 0) {
  576. exclusionList = new ArrayList(srcFiles.length);
  577. File[] arr$ = srcFiles;
  578. int len$ = srcFiles.length;
  579.  
  580. for(int i$ = 0; i$ < len$; ++i$) {
  581. File srcFile = arr$[i$];
  582. File copiedFile = new File(destDir, srcFile.getName());
  583. exclusionList.add(copiedFile.getCanonicalPath());
  584. }
  585. }
  586. }
  587.  
  588. doCopyDirectory(srcDir, destDir, filter, preserveFileDate, exclusionList);
  589. }
  590. }
  591.  
  592. private static void doCopyDirectory(File srcDir, File destDir, FileFilter filter, boolean preserveFileDate, List<String> exclusionList) throws IOException {
  593. File[] srcFiles = filter == null ? srcDir.listFiles() : srcDir.listFiles(filter);
  594. if (srcFiles == null) {
  595. throw new IOException("Failed to list contents of " + srcDir);
  596. } else {
  597. if (destDir.exists()) {
  598. if (!destDir.isDirectory()) {
  599. throw new IOException("Destination '" + destDir + "' exists but is not a directory");
  600. }
  601. } else if (!destDir.mkdirs() && !destDir.isDirectory()) {
  602. throw new IOException("Destination '" + destDir + "' directory cannot be created");
  603. }
  604.  
  605. if (!destDir.canWrite()) {
  606. throw new IOException("Destination '" + destDir + "' cannot be written to");
  607. } else {
  608. File[] arr$ = srcFiles;
  609. int len$ = srcFiles.length;
  610.  
  611. for(int i$ = 0; i$ < len$; ++i$) {
  612. File srcFile = arr$[i$];
  613. File dstFile = new File(destDir, srcFile.getName());
  614. if (exclusionList == null || !exclusionList.contains(srcFile.getCanonicalPath())) {
  615. if (srcFile.isDirectory()) {
  616. doCopyDirectory(srcFile, dstFile, filter, preserveFileDate, exclusionList);
  617. } else {
  618. doCopyFile(srcFile, dstFile, preserveFileDate);
  619. }
  620. }
  621. }
  622.  
  623. if (preserveFileDate) {
  624. destDir.setLastModified(srcDir.lastModified());
  625. }
  626.  
  627. }
  628. }
  629. }
  630.  
  631. public static void copyURLToFile(URL source, File destination) throws IOException {
  632. InputStream input = source.openStream();
  633. copyInputStreamToFile(input, destination);
  634. }
  635.  
  636. public static void copyURLToFile(URL source, File destination, int connectionTimeout, int readTimeout) throws IOException {
  637. URLConnection connection = source.openConnection();
  638. connection.setConnectTimeout(connectionTimeout);
  639. connection.setReadTimeout(readTimeout);
  640. InputStream input = connection.getInputStream();
  641. copyInputStreamToFile(input, destination);
  642. }
  643.  
  644. public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
  645. try {
  646. FileOutputStream output = openOutputStream(destination);
  647.  
  648. try {
  649. IOUtils.copy(source, output);
  650. output.close();
  651. } finally {
  652. IOUtils.closeQuietly(output);
  653. }
  654. } finally {
  655. IOUtils.closeQuietly(source);
  656. }
  657.  
  658. }
  659.  
  660. public static void deleteDirectory(File directory) throws IOException {
  661. if (directory.exists()) {
  662. if (!isSymlink(directory)) {
  663. cleanDirectory(directory);
  664. }
  665.  
  666. if (!directory.delete()) {
  667. String message = "Unable to delete directory " + directory + ".";
  668. throw new IOException(message);
  669. }
  670. }
  671. }
  672.  
  673. public static boolean deleteQuietly(File file) {
  674. if (file == null) {
  675. return false;
  676. } else {
  677. try {
  678. if (file.isDirectory()) {
  679. cleanDirectory(file);
  680. }
  681. } catch (Exception var3) {
  682. }
  683.  
  684. try {
  685. return file.delete();
  686. } catch (Exception var2) {
  687. return false;
  688. }
  689. }
  690. }
  691.  
  692. public static boolean directoryContains(File directory, File child) throws IOException {
  693. if (directory == null) {
  694. throw new IllegalArgumentException("Directory must not be null");
  695. } else if (!directory.isDirectory()) {
  696. throw new IllegalArgumentException("Not a directory: " + directory);
  697. } else if (child == null) {
  698. return false;
  699. } else if (directory.exists() && child.exists()) {
  700. String canonicalParent = directory.getCanonicalPath();
  701. String canonicalChild = child.getCanonicalPath();
  702. return FilenameUtils.directoryContains(canonicalParent, canonicalChild);
  703. } else {
  704. return false;
  705. }
  706. }
  707.  
  708. public static void cleanDirectory(File directory) throws IOException {
  709. String message;
  710. if (!directory.exists()) {
  711. message = directory + " does not exist";
  712. throw new IllegalArgumentException(message);
  713. } else if (!directory.isDirectory()) {
  714. message = directory + " is not a directory";
  715. throw new IllegalArgumentException(message);
  716. } else {
  717. File[] files = directory.listFiles();
  718. if (files == null) {
  719. throw new IOException("Failed to list contents of " + directory);
  720. } else {
  721. IOException exception = null;
  722. File[] arr$ = files;
  723. int len$ = files.length;
  724.  
  725. for(int i$ = 0; i$ < len$; ++i$) {
  726. File file = arr$[i$];
  727.  
  728. try {
  729. forceDelete(file);
  730. } catch (IOException var8) {
  731. exception = var8;
  732. }
  733. }
  734.  
  735. if (null != exception) {
  736. throw exception;
  737. }
  738. }
  739. }
  740. }
  741.  
  742. public static boolean waitFor(File file, int seconds) {
  743. int timeout = 0;
  744. int tick = 0;
  745.  
  746. while(!file.exists()) {
  747. if (tick++ >= 10) {
  748. tick = 0;
  749. if (timeout++ > seconds) {
  750. return false;
  751. }
  752. }
  753.  
  754. try {
  755. Thread.sleep(100L);
  756. } catch (InterruptedException var5) {
  757. } catch (Exception var6) {
  758. break;
  759. }
  760. }
  761.  
  762. return true;
  763. }
  764.  
  765. public static String readFileToString(File file, Charset encoding) throws IOException {
  766. FileInputStream in = null;
  767.  
  768. String var3;
  769. try {
  770. in = openInputStream(file);
  771. var3 = IOUtils.toString(in, Charsets.toCharset(encoding));
  772. } finally {
  773. IOUtils.closeQuietly(in);
  774. }
  775.  
  776. return var3;
  777. }
  778.  
  779. public static String readFileToString(File file, String encoding) throws IOException {
  780. return readFileToString(file, Charsets.toCharset(encoding));
  781. }
  782.  
  783. public static String readFileToString(File file) throws IOException {
  784. return readFileToString(file, Charset.defaultCharset());
  785. }
  786.  
  787. public static byte[] readFileToByteArray(File file) throws IOException {
  788. FileInputStream in = null;
  789.  
  790. byte[] var2;
  791. try {
  792. in = openInputStream(file);
  793. var2 = IOUtils.toByteArray(in, file.length());
  794. } finally {
  795. IOUtils.closeQuietly(in);
  796. }
  797.  
  798. return var2;
  799. }
  800.  
  801. public static List<String> readLines(File file, Charset encoding) throws IOException {
  802. FileInputStream in = null;
  803.  
  804. List var3;
  805. try {
  806. in = openInputStream(file);
  807. var3 = IOUtils.readLines(in, Charsets.toCharset(encoding));
  808. } finally {
  809. IOUtils.closeQuietly(in);
  810. }
  811.  
  812. return var3;
  813. }
  814.  
  815. public static List<String> readLines(File file, String encoding) throws IOException {
  816. return readLines(file, Charsets.toCharset(encoding));
  817. }
  818.  
  819. public static List<String> readLines(File file) throws IOException {
  820. return readLines(file, Charset.defaultCharset());
  821. }
  822.  
  823. public static LineIterator lineIterator(File file, String encoding) throws IOException {
  824. FileInputStream in = null;
  825.  
  826. try {
  827. in = openInputStream(file);
  828. return IOUtils.lineIterator(in, encoding);
  829. } catch (IOException var4) {
  830. IOUtils.closeQuietly(in);
  831. throw var4;
  832. } catch (RuntimeException var5) {
  833. IOUtils.closeQuietly(in);
  834. throw var5;
  835. }
  836. }
  837.  
  838. public static LineIterator lineIterator(File file) throws IOException {
  839. return lineIterator(file, (String)null);
  840. }
  841.  
  842. public static void writeStringToFile(File file, String data, Charset encoding) throws IOException {
  843. writeStringToFile(file, data, encoding, false);
  844. }
  845.  
  846. public static void writeStringToFile(File file, String data, String encoding) throws IOException {
  847. writeStringToFile(file, data, encoding, false);
  848. }
  849.  
  850. public static void writeStringToFile(File file, String data, Charset encoding, boolean append) throws IOException {
  851. FileOutputStream out = null;
  852.  
  853. try {
  854. out = openOutputStream(file, append);
  855. IOUtils.write(data, out, encoding);
  856. out.close();
  857. } finally {
  858. IOUtils.closeQuietly(out);
  859. }
  860.  
  861. }
  862.  
  863. public static void writeStringToFile(File file, String data, String encoding, boolean append) throws IOException {
  864. writeStringToFile(file, data, Charsets.toCharset(encoding), append);
  865. }
  866.  
  867. public static void writeStringToFile(File file, String data) throws IOException {
  868. writeStringToFile(file, data, Charset.defaultCharset(), false);
  869. }
  870.  
  871. public static void writeStringToFile(File file, String data, boolean append) throws IOException {
  872. writeStringToFile(file, data, Charset.defaultCharset(), append);
  873. }
  874.  
  875. public static void write(File file, CharSequence data) throws IOException {
  876. write(file, data, Charset.defaultCharset(), false);
  877. }
  878.  
  879. public static void write(File file, CharSequence data, boolean append) throws IOException {
  880. write(file, data, Charset.defaultCharset(), append);
  881. }
  882.  
  883. public static void write(File file, CharSequence data, Charset encoding) throws IOException {
  884. write(file, data, encoding, false);
  885. }
  886.  
  887. public static void write(File file, CharSequence data, String encoding) throws IOException {
  888. write(file, data, encoding, false);
  889. }
  890.  
  891. public static void write(File file, CharSequence data, Charset encoding, boolean append) throws IOException {
  892. String str = data == null ? null : data.toString();
  893. writeStringToFile(file, str, encoding, append);
  894. }
  895.  
  896. public static void write(File file, CharSequence data, String encoding, boolean append) throws IOException {
  897. write(file, data, Charsets.toCharset(encoding), append);
  898. }
  899.  
  900. public static void writeByteArrayToFile(File file, byte[] data) throws IOException {
  901. writeByteArrayToFile(file, data, false);
  902. }
  903.  
  904. public static void writeByteArrayToFile(File file, byte[] data, boolean append) throws IOException {
  905. FileOutputStream out = null;
  906.  
  907. try {
  908. out = openOutputStream(file, append);
  909. out.write(data);
  910. out.close();
  911. } finally {
  912. IOUtils.closeQuietly(out);
  913. }
  914.  
  915. }
  916.  
  917. public static void writeLines(File file, String encoding, Collection<?> lines) throws IOException {
  918. writeLines(file, encoding, lines, (String)null, false);
  919. }
  920.  
  921. public static void writeLines(File file, String encoding, Collection<?> lines, boolean append) throws IOException {
  922. writeLines(file, encoding, lines, (String)null, append);
  923. }
  924.  
  925. public static void writeLines(File file, Collection<?> lines) throws IOException {
  926. writeLines(file, (String)null, lines, (String)null, false);
  927. }
  928.  
  929. public static void writeLines(File file, Collection<?> lines, boolean append) throws IOException {
  930. writeLines(file, (String)null, lines, (String)null, append);
  931. }
  932.  
  933. public static void writeLines(File file, String encoding, Collection<?> lines, String lineEnding) throws IOException {
  934. writeLines(file, encoding, lines, lineEnding, false);
  935. }
  936.  
  937. public static void writeLines(File file, String encoding, Collection<?> lines, String lineEnding, boolean append) throws IOException {
  938. FileOutputStream out = null;
  939.  
  940. try {
  941. out = openOutputStream(file, append);
  942. BufferedOutputStream buffer = new BufferedOutputStream(out);
  943. IOUtils.writeLines(lines, lineEnding, buffer, encoding);
  944. buffer.flush();
  945. out.close();
  946. } finally {
  947. IOUtils.closeQuietly(out);
  948. }
  949.  
  950. }
  951.  
  952. public static void writeLines(File file, Collection<?> lines, String lineEnding) throws IOException {
  953. writeLines(file, (String)null, lines, lineEnding, false);
  954. }
  955.  
  956. public static void writeLines(File file, Collection<?> lines, String lineEnding, boolean append) throws IOException {
  957. writeLines(file, (String)null, lines, lineEnding, append);
  958. }
  959.  
  960. public static void forceDelete(File file) throws IOException {
  961. if (file.isDirectory()) {
  962. deleteDirectory(file);
  963. } else {
  964. boolean filePresent = file.exists();
  965. if (!file.delete()) {
  966. if (!filePresent) {
  967. throw new FileNotFoundException("File does not exist: " + file);
  968. }
  969.  
  970. String message = "Unable to delete file: " + file;
  971. throw new IOException(message);
  972. }
  973. }
  974.  
  975. }
  976.  
  977. public static void forceDeleteOnExit(File file) throws IOException {
  978. if (file.isDirectory()) {
  979. deleteDirectoryOnExit(file);
  980. } else {
  981. file.deleteOnExit();
  982. }
  983.  
  984. }
  985.  
  986. private static void deleteDirectoryOnExit(File directory) throws IOException {
  987. if (directory.exists()) {
  988. directory.deleteOnExit();
  989. if (!isSymlink(directory)) {
  990. cleanDirectoryOnExit(directory);
  991. }
  992.  
  993. }
  994. }
  995.  
  996. private static void cleanDirectoryOnExit(File directory) throws IOException {
  997. String message;
  998. if (!directory.exists()) {
  999. message = directory + " does not exist";
  1000. throw new IllegalArgumentException(message);
  1001. } else if (!directory.isDirectory()) {
  1002. message = directory + " is not a directory";
  1003. throw new IllegalArgumentException(message);
  1004. } else {
  1005. File[] files = directory.listFiles();
  1006. if (files == null) {
  1007. throw new IOException("Failed to list contents of " + directory);
  1008. } else {
  1009. IOException exception = null;
  1010. File[] arr$ = files;
  1011. int len$ = files.length;
  1012.  
  1013. for(int i$ = 0; i$ < len$; ++i$) {
  1014. File file = arr$[i$];
  1015.  
  1016. try {
  1017. forceDeleteOnExit(file);
  1018. } catch (IOException var8) {
  1019. exception = var8;
  1020. }
  1021. }
  1022.  
  1023. if (null != exception) {
  1024. throw exception;
  1025. }
  1026. }
  1027. }
  1028. }
  1029.  
  1030. public static void forceMkdir(File directory) throws IOException {
  1031. String message;
  1032. if (directory.exists()) {
  1033. if (!directory.isDirectory()) {
  1034. message = "File " + directory + " exists and is " + "not a directory. Unable to create directory.";
  1035. throw new IOException(message);
  1036. }
  1037. } else if (!directory.mkdirs() && !directory.isDirectory()) {
  1038. message = "Unable to create directory " + directory;
  1039. throw new IOException(message);
  1040. }
  1041.  
  1042. }
  1043.  
  1044. public static long sizeOf(File file) {
  1045. if (!file.exists()) {
  1046. String message = file + " does not exist";
  1047. throw new IllegalArgumentException(message);
  1048. } else {
  1049. return file.isDirectory() ? sizeOfDirectory(file) : file.length();
  1050. }
  1051. }
  1052.  
  1053. public static BigInteger sizeOfAsBigInteger(File file) {
  1054. if (!file.exists()) {
  1055. String message = file + " does not exist";
  1056. throw new IllegalArgumentException(message);
  1057. } else {
  1058. return file.isDirectory() ? sizeOfDirectoryAsBigInteger(file) : BigInteger.valueOf(file.length());
  1059. }
  1060. }
  1061.  
  1062. public static long sizeOfDirectory(File directory) {
  1063. checkDirectory(directory);
  1064. File[] files = directory.listFiles();
  1065. if (files == null) {
  1066. return 0L;
  1067. } else {
  1068. long size = 0L;
  1069. File[] arr$ = files;
  1070. int len$ = files.length;
  1071.  
  1072. for(int i$ = 0; i$ < len$; ++i$) {
  1073. File file = arr$[i$];
  1074.  
  1075. try {
  1076. if (!isSymlink(file)) {
  1077. size += sizeOf(file);
  1078. if (size < 0L) {
  1079. break;
  1080. }
  1081. }
  1082. } catch (IOException var9) {
  1083. }
  1084. }
  1085.  
  1086. return size;
  1087. }
  1088. }
  1089.  
  1090. public static BigInteger sizeOfDirectoryAsBigInteger(File directory) {
  1091. checkDirectory(directory);
  1092. File[] files = directory.listFiles();
  1093. if (files == null) {
  1094. return BigInteger.ZERO;
  1095. } else {
  1096. BigInteger size = BigInteger.ZERO;
  1097. File[] arr$ = files;
  1098. int len$ = files.length;
  1099.  
  1100. for(int i$ = 0; i$ < len$; ++i$) {
  1101. File file = arr$[i$];
  1102.  
  1103. try {
  1104. if (!isSymlink(file)) {
  1105. size = size.add(BigInteger.valueOf(sizeOf(file)));
  1106. }
  1107. } catch (IOException var8) {
  1108. }
  1109. }
  1110.  
  1111. return size;
  1112. }
  1113. }
  1114.  
  1115. private static void checkDirectory(File directory) {
  1116. if (!directory.exists()) {
  1117. throw new IllegalArgumentException(directory + " does not exist");
  1118. } else if (!directory.isDirectory()) {
  1119. throw new IllegalArgumentException(directory + " is not a directory");
  1120. }
  1121. }
  1122.  
  1123. public static boolean isFileNewer(File file, File reference) {
  1124. if (reference == null) {
  1125. throw new IllegalArgumentException("No specified reference file");
  1126. } else if (!reference.exists()) {
  1127. throw new IllegalArgumentException("The reference file '" + reference + "' doesn't exist");
  1128. } else {
  1129. return isFileNewer(file, reference.lastModified());
  1130. }
  1131. }
  1132.  
  1133. public static boolean isFileNewer(File file, Date date) {
  1134. if (date == null) {
  1135. throw new IllegalArgumentException("No specified date");
  1136. } else {
  1137. return isFileNewer(file, date.getTime());
  1138. }
  1139. }
  1140.  
  1141. public static boolean isFileNewer(File file, long timeMillis) {
  1142. if (file == null) {
  1143. throw new IllegalArgumentException("No specified file");
  1144. } else if (!file.exists()) {
  1145. return false;
  1146. } else {
  1147. return file.lastModified() > timeMillis;
  1148. }
  1149. }
  1150.  
  1151. public static boolean isFileOlder(File file, File reference) {
  1152. if (reference == null) {
  1153. throw new IllegalArgumentException("No specified reference file");
  1154. } else if (!reference.exists()) {
  1155. throw new IllegalArgumentException("The reference file '" + reference + "' doesn't exist");
  1156. } else {
  1157. return isFileOlder(file, reference.lastModified());
  1158. }
  1159. }
  1160.  
  1161. public static boolean isFileOlder(File file, Date date) {
  1162. if (date == null) {
  1163. throw new IllegalArgumentException("No specified date");
  1164. } else {
  1165. return isFileOlder(file, date.getTime());
  1166. }
  1167. }
  1168.  
  1169. public static boolean isFileOlder(File file, long timeMillis) {
  1170. if (file == null) {
  1171. throw new IllegalArgumentException("No specified file");
  1172. } else if (!file.exists()) {
  1173. return false;
  1174. } else {
  1175. return file.lastModified() < timeMillis;
  1176. }
  1177. }
  1178.  
  1179. public static long checksumCRC32(File file) throws IOException {
  1180. CRC32 crc = new CRC32();
  1181. checksum(file, crc);
  1182. return crc.getValue();
  1183. }
  1184.  
  1185. public static Checksum checksum(File file, Checksum checksum) throws IOException {
  1186. if (file.isDirectory()) {
  1187. throw new IllegalArgumentException("Checksums can't be computed on directories");
  1188. } else {
  1189. CheckedInputStream in = null;
  1190.  
  1191. try {
  1192. in = new CheckedInputStream(new FileInputStream(file), checksum);
  1193. IOUtils.copy(in, new NullOutputStream());
  1194. } finally {
  1195. IOUtils.closeQuietly(in);
  1196. }
  1197.  
  1198. return checksum;
  1199. }
  1200. }
  1201.  
  1202. public static void moveDirectory(File srcDir, File destDir) throws IOException {
  1203. if (srcDir == null) {
  1204. throw new NullPointerException("Source must not be null");
  1205. } else if (destDir == null) {
  1206. throw new NullPointerException("Destination must not be null");
  1207. } else if (!srcDir.exists()) {
  1208. throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
  1209. } else if (!srcDir.isDirectory()) {
  1210. throw new IOException("Source '" + srcDir + "' is not a directory");
  1211. } else if (destDir.exists()) {
  1212. throw new FileExistsException("Destination '" + destDir + "' already exists");
  1213. } else {
  1214. boolean rename = srcDir.renameTo(destDir);
  1215. if (!rename) {
  1216. if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
  1217. throw new IOException("Cannot move directory: " + srcDir + " to a subdirectory of itself: " + destDir);
  1218. }
  1219.  
  1220. copyDirectory(srcDir, destDir);
  1221. deleteDirectory(srcDir);
  1222. if (srcDir.exists()) {
  1223. throw new IOException("Failed to delete original directory '" + srcDir + "' after copy to '" + destDir + "'");
  1224. }
  1225. }
  1226.  
  1227. }
  1228. }
  1229.  
  1230. public static void moveDirectoryToDirectory(File src, File destDir, boolean createDestDir) throws IOException {
  1231. if (src == null) {
  1232. throw new NullPointerException("Source must not be null");
  1233. } else if (destDir == null) {
  1234. throw new NullPointerException("Destination directory must not be null");
  1235. } else {
  1236. if (!destDir.exists() && createDestDir) {
  1237. destDir.mkdirs();
  1238. }
  1239.  
  1240. if (!destDir.exists()) {
  1241. throw new FileNotFoundException("Destination directory '" + destDir + "' does not exist [createDestDir=" + createDestDir + "]");
  1242. } else if (!destDir.isDirectory()) {
  1243. throw new IOException("Destination '" + destDir + "' is not a directory");
  1244. } else {
  1245. moveDirectory(src, new File(destDir, src.getName()));
  1246. }
  1247. }
  1248. }
  1249.  
  1250. public static void moveFile(File srcFile, File destFile) throws IOException {
  1251. if (srcFile == null) {
  1252. throw new NullPointerException("Source must not be null");
  1253. } else if (destFile == null) {
  1254. throw new NullPointerException("Destination must not be null");
  1255. } else if (!srcFile.exists()) {
  1256. throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
  1257. } else if (srcFile.isDirectory()) {
  1258. throw new IOException("Source '" + srcFile + "' is a directory");
  1259. } else if (destFile.exists()) {
  1260. throw new FileExistsException("Destination '" + destFile + "' already exists");
  1261. } else if (destFile.isDirectory()) {
  1262. throw new IOException("Destination '" + destFile + "' is a directory");
  1263. } else {
  1264. boolean rename = srcFile.renameTo(destFile);
  1265. if (!rename) {
  1266. copyFile(srcFile, destFile);
  1267. if (!srcFile.delete()) {
  1268. deleteQuietly(destFile);
  1269. throw new IOException("Failed to delete original file '" + srcFile + "' after copy to '" + destFile + "'");
  1270. }
  1271. }
  1272.  
  1273. }
  1274. }
  1275.  
  1276. public static void moveFileToDirectory(File srcFile, File destDir, boolean createDestDir) throws IOException {
  1277. if (srcFile == null) {
  1278. throw new NullPointerException("Source must not be null");
  1279. } else if (destDir == null) {
  1280. throw new NullPointerException("Destination directory must not be null");
  1281. } else {
  1282. if (!destDir.exists() && createDestDir) {
  1283. destDir.mkdirs();
  1284. }
  1285.  
  1286. if (!destDir.exists()) {
  1287. throw new FileNotFoundException("Destination directory '" + destDir + "' does not exist [createDestDir=" + createDestDir + "]");
  1288. } else if (!destDir.isDirectory()) {
  1289. throw new IOException("Destination '" + destDir + "' is not a directory");
  1290. } else {
  1291. moveFile(srcFile, new File(destDir, srcFile.getName()));
  1292. }
  1293. }
  1294. }
  1295.  
  1296. public static void moveToDirectory(File src, File destDir, boolean createDestDir) throws IOException {
  1297. if (src == null) {
  1298. throw new NullPointerException("Source must not be null");
  1299. } else if (destDir == null) {
  1300. throw new NullPointerException("Destination must not be null");
  1301. } else if (!src.exists()) {
  1302. throw new FileNotFoundException("Source '" + src + "' does not exist");
  1303. } else {
  1304. if (src.isDirectory()) {
  1305. moveDirectoryToDirectory(src, destDir, createDestDir);
  1306. } else {
  1307. moveFileToDirectory(src, destDir, createDestDir);
  1308. }
  1309.  
  1310. }
  1311. }
  1312.  
  1313. public static boolean isSymlink(File file) throws IOException {
  1314. if (file == null) {
  1315. throw new NullPointerException("File must not be null");
  1316. } else if (FilenameUtils.isSystemWindows()) {
  1317. return false;
  1318. } else {
  1319. File fileInCanonicalDir = null;
  1320. if (file.getParent() == null) {
  1321. fileInCanonicalDir = file;
  1322. } else {
  1323. File canonicalDir = file.getParentFile().getCanonicalFile();
  1324. fileInCanonicalDir = new File(canonicalDir, file.getName());
  1325. }
  1326.  
  1327. return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile());
  1328. }
  1329. }
  1330.  
  1331. static {
  1332. ONE_MB_BI = ONE_KB_BI.multiply(ONE_KB_BI);
  1333. ONE_GB_BI = ONE_KB_BI.multiply(ONE_MB_BI);
  1334. ONE_TB_BI = ONE_KB_BI.multiply(ONE_GB_BI);
  1335. ONE_PB_BI = ONE_KB_BI.multiply(ONE_TB_BI);
  1336. ONE_EB_BI = ONE_KB_BI.multiply(ONE_PB_BI);
  1337. ONE_ZB = BigInteger.valueOf(1024L).multiply(BigInteger.valueOf(1152921504606846976L));
  1338. ONE_YB = ONE_KB_BI.multiply(ONE_ZB);
  1339. EMPTY_FILE_ARRAY = new File[0];
  1340. UTF8 = Charset.forName("UTF-8");
  1341. }
  1342. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment