void (final long len) { final Path lengthFile = getLengthFile(); try (DataOutputStream stream = FileUtilRt.doIOOperation(lastAttempt -> { try { return new DataOutputStream(Files.newOutputStream(lengthFile)); } catch (NoSuchFileException ex) { ensureParentDirectoryExists(); if (!lastAttempt) return null; throw ex; } })) { if (stream != null) { stream.writeLong(len); } } catch (IOException e) { LOG.error(e); } }