@Test public void testGetNumberOfChunksSizeNegative() throws IOException { File file = new File(parent, randomString()); FileUtils.write(file, "test"); assertEquals(0, FileChunkUtil.getNumberOfChunks(file, -1 * TestFileConfiguration.CHUNK_SIZE)); file.deleteOnExit(); }
public static int getNumberOfChunks(File file, int chunkSize) { if (file == null || !file.exists()) { return 0; } else if (chunkSize <= 0) { return 0; } long fileSize = FileUtil.getFileSize(file); if (fileSize == 0) { return 1; } return (int) Math.ceil((double) fileSize / Math.abs(chunkSize)); }
FileChunkUtil { public static int getNumberOfChunks(File file, int chunkSize) { if (file == null || !file.exists()) { return 0; } else if (chunkSize <= 0) { return 0; } long fileSize = FileUtil.getFileSize(file); if (fileSize == 0) { return 1; } return (int) Math.ceil((double) fileSize / Math.abs(chunkSize)); } }
FileChunkUtil { public static int getNumberOfChunks(File file, int chunkSize) { if (file == null || !file.exists()) { return 0; } else if (chunkSize <= 0) { return 0; } long fileSize = FileUtil.getFileSize(file); if (fileSize == 0) { return 1; } return (int) Math.ceil((double) fileSize / Math.abs(chunkSize)); } private  FileChunkUtil(); }
FileChunkUtil { public static int getNumberOfChunks(File file, int chunkSize) { if (file == null || !file.exists()) { return 0; } else if (chunkSize <= 0) { return 0; } long fileSize = FileUtil.getFileSize(file); if (fileSize == 0) { return 1; } return (int) Math.ceil((double) fileSize / Math.abs(chunkSize)); } private  FileChunkUtil(); static int getNumberOfChunks(File file, int chunkSize); static Chunk getChunk(File file, int chunkSize, int chunkNumber, String chunkId); static void reassembly(List<File> fileParts, File destination); }
FileChunkUtil { public static int getNumberOfChunks(File file, int chunkSize) { if (file == null || !file.exists()) { return 0; } else if (chunkSize <= 0) { return 0; } long fileSize = FileUtil.getFileSize(file); if (fileSize == 0) { return 1; } return (int) Math.ceil((double) fileSize / Math.abs(chunkSize)); } private  FileChunkUtil(); static int getNumberOfChunks(File file, int chunkSize); static Chunk getChunk(File file, int chunkSize, int chunkNumber, String chunkId); static void reassembly(List<File> fileParts, File destination);  }