[Bug 61246] remove flush method
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1800712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0c9a1ef203
commit
68be989d22
@ -20,6 +20,7 @@
|
|||||||
package org.apache.poi.xssf.streaming;
|
package org.apache.poi.xssf.streaming;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -48,7 +49,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
|
|||||||
* this class only writes the "sheetData" document fragment
|
* this class only writes the "sheetData" document fragment
|
||||||
* so that it was renamed to "SheetDataWriter"
|
* so that it was renamed to "SheetDataWriter"
|
||||||
*/
|
*/
|
||||||
public class SheetDataWriter {
|
public class SheetDataWriter implements Closeable {
|
||||||
private static final POILogger logger = POILogFactory.getLogger(SheetDataWriter.class);
|
private static final POILogger logger = POILogFactory.getLogger(SheetDataWriter.class);
|
||||||
|
|
||||||
private final File _fd;
|
private final File _fd;
|
||||||
@ -123,12 +124,8 @@ public class SheetDataWriter {
|
|||||||
* This method <em>must</em> be invoked before calling {@link #getWorksheetXMLInputStream()}
|
* This method <em>must</em> be invoked before calling {@link #getWorksheetXMLInputStream()}
|
||||||
*/
|
*/
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
flush();
|
|
||||||
_out.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void flush() throws IOException {
|
|
||||||
_out.flush();
|
_out.flush();
|
||||||
|
_out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected File getTempFile() {
|
protected File getTempFile() {
|
||||||
|
@ -58,7 +58,7 @@ public final class TestSheetDataWriter {
|
|||||||
SheetDataWriter writer = new SheetDataWriter();
|
SheetDataWriter writer = new SheetDataWriter();
|
||||||
try {
|
try {
|
||||||
writer.outputQuotedString(unicodeSurrogates);
|
writer.outputQuotedString(unicodeSurrogates);
|
||||||
writer.flush();
|
writer.close();
|
||||||
File file = writer.getTempFile();
|
File file = writer.getTempFile();
|
||||||
FileInputStream is = new FileInputStream(file);
|
FileInputStream is = new FileInputStream(file);
|
||||||
String text;
|
String text;
|
||||||
@ -69,7 +69,7 @@ public final class TestSheetDataWriter {
|
|||||||
}
|
}
|
||||||
assertEquals(unicodeSurrogates, text);
|
assertEquals(unicodeSurrogates, text);
|
||||||
} finally {
|
} finally {
|
||||||
writer.close();
|
IOUtils.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user