public ByteBuffer getByteBufferFromDisk(User user, int dashId, int deviceId, PinType pinType, short pin, int count, GraphGranularityType type, int skipCount) { Path userDataFile = Paths.get( dataFolder, FileUtils.getUserStorageDir(user.email, user.appName), generateFilename(dashId, deviceId, pinType, pin, type) ); if (Files.exists(userDataFile)) { try { return FileUtils.read(userDataFile, count, skipCount); } catch (Exception ioe) { log.error(ioe); } } return null; }
long fileSize = Files.size(userReportingFile); if (fileSize > maxRecordsCount * REPORTING_RECORD_SIZE) { ByteBuffer userReportingData = FileUtils.read(userReportingFile, maxRecordsCount); try (OutputStream os = Files.newOutputStream(userReportingFile, TRUNCATE_EXISTING)) {
try { Path path = file.toPath(); ByteBuffer userReportingData = FileUtils.read(path, count); write(file, userReportingData); System.out.println("Successfully copied. Truncated : "