private synchronized void storeMetaInfoIntoFile() throws FileAccessException { _timeLastAction = TimeUtil.localToUtc(); File tmpFile = new File(META_INFO_FILENAME); FileWriter file = null; BufferedWriter bw = null; PrintWriter pw = null; try { file = new FileWriter(tmpFile); bw = new BufferedWriter(file); pw = new PrintWriter(bw); pw.println(_blockSize); pw.println(parseBlockReceivedToString()); pw.println(_totalBlocks); pw.println(_fileId); pw.println(_lastBlock); pw.println(_lastBlockSent); pw.println(_lastBlockSize); pw.println(_subPath); pw.println(_thresholdSize); pw.println(_transId); pw.println(parseBlockFilenameToString()); pw.println(_timeCreated); pw.println(_originalEventId); pw.println(_GNCI); pw.println(_finishedOnce); int originalDataLen = (_originalData == null) ? -1 : _originalData.length; pw.println(originalDataLen); for (int i = 0; i < originalDataLen; i++) { if (_originalData[i] != null) pw.println(_originalData[i]); else pw.println(NULL_DELIMITER); } pw.println(_timeLastAction); close(pw); if (FileHelper.exist(IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME)) FileHelper.replace( IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME, tmpFile); else FileHelper.create( IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME, tmpFile); tmpFile.delete(); } catch (IOException ioe) { throw new FileAccessException("Unable to store meta info to file."); } finally { close(pw); } }