@Override public void destroy() { if ( filterWriter != null ) { filterWriter.close(); } }
@Override public void close() { delegate.close(); }
public void close () { if ( writer != null ) { writer.close(); writer = null; } if ( filter != null ) { filter.close(); filter = null; } }
@Override public void close() { if (writer != null) writer.close(); // must null so new writer type will be // instantiated on next use writer = null; skeletonFilter.close(); }
protected void processEndSubDocument (Ending res) { try { // Finish writing the sub-document subDocWriter.handleEvent(new Event(EventType.END_DOCUMENT, res)); subDocWriter.close(); // Reset subDocWriter, next sub-document might require a different writer // (a default writer will be created if not set from outside) subDocWriter = null; // Create the new entry from the temporary output file zipOut.putNextEntry(new ZipEntry(entryName)); InputStream input = new FileInputStream(tempFile); int len; while ( (len = input.read(buffer)) > 0 ) { zipOut.write(buffer, 0, len); } input.close(); zipOut.closeEntry(); // Delete the temporary file tempFile.delete(); } catch ( IOException e ) { throw new OkapiException(e); } }
private void closeFilterAndWriter () { if ( writer != null ) { writer.close(); writer = null; } if ( filter1 != null ) { filter1.close(); filter1 = null; } if ( filter2 != null ) { filter2.close(); filter2 = null; } }
@SuppressWarnings("resource") private Event processEndDocument (Event event) { // Handle the END_DOCUMENT event and close the writer filterWriter.handleEvent(event); filterWriter.close(); // Return the RawDocument Event that is the end result of all previous Events // Note that the source locale is now set to the 'target locale' value since it is an output // We also set the target to the same value to have a value if (outputStream == null) { RawDocument input = new RawDocument(outputFile.toURI(), outputEncoding, targetLocale, targetLocale); return new Event(EventType.RAW_DOCUMENT, input); } else { // outputstream already written to return Event.NOOP_EVENT; } }
private void processEndSubDocument (Ending res) { try { SubDocumentValues subDocumentValues = tmSubDoc.get(ndxSubDoc--); subDocWriter = subDocumentValues.getFilterWriter(); subDocEntry = subDocumentValues.getZipEntry(); tempFile = subDocumentValues.getTempFile(); // Finish writing the sub-document subDocWriter.handleEvent(new Event(EventType.END_DOCUMENT, res)); subDocWriter.close(); // Create the new entry from the temporary output file zipOutputStream.putNextEntry(new ZipEntry(subDocEntry.getName())); InputStream input = new FileInputStream(tempFile); int len; while ( (len = input.read(buffer)) > 0 ) { zipOutputStream.write(buffer, 0, len); } input.close(); zipOutputStream.closeEntry(); // Delete the temporary file tempFile.delete(); tempFile = null; } catch ( IOException e ) { throw new OkapiIOException("Error closing zip output file."); } }
private void flushFilterEvents () { // Finish to go through the original file while ( filter.hasNext() ) { writer.handleEvent(filter.next()); } writer.close(); }
subDocWriter.close();
private void flushFilterEvents() { try { // Finish the skeleton events Event event = null; while (skeletonFilter.hasNext()) { event = skeletonFilter.next(); if (event.isTextUnit()) { throw new OkapiMergeException(String.format( "No corresponding text unit for id='%s' in the skeleton file.", event.getTextUnit().getId())); } writer.handleEvent(event); } } finally { writer.close(); } }
filterWriter.handleEvent(event); if ( filterWriter != null ) { filterWriter.close();
writer.handleEvent(event1); writer.close(); filter1.close();
filterWriter.close(); return null;
if (xlfReader != null) xlfReader.close(); if (filter != null) filter.close(); if (writer != null) writer.close();