void (File dataStorageRoot, DataInputStream original, final long ordinal) { if (LOG.isDebugEnabled()) { LOG.debug("updateFsStateOnDisk, ordinal=" + ordinal); } final File file = new File(dataStorageRoot, FS_STATE_FILE); try { final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(); try (DataOutputStream out = new DataOutputStream(bytes)) { out.writeInt(BuildFSState.VERSION); out.writeLong(ordinal); out.writeBoolean(false); while (true) { final int b = original.read(); if (b == -1) { break; } out.write(b); } } saveOnDisk(bytes, file); } catch (Throwable e) { LOG.error(e); FileUtil.delete(file); } }