Skip to content

Commit dc126eb

Browse files
committed
createInput() and createOutput() now both use buffered streams by default
1 parent 739cf0e commit dc126eb

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

core/src/processing/core/PApplet.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6920,7 +6920,7 @@ static public PrintWriter createWriter(OutputStream output) {
69206920
*
69216921
*/
69226922
public InputStream createInput(String filename) {
6923-
InputStream input = createInputRaw(filename);
6923+
InputStream input = new BufferedInputStream(createInputRaw(filename));
69246924
final String lower = filename.toLowerCase();
69256925
if ((input != null) &&
69266926
(lower.endsWith(".gz") || lower.endsWith(".svgz"))) {
@@ -7360,11 +7360,12 @@ public OutputStream createOutput(String filename) {
73607360
static public OutputStream createOutput(File file) {
73617361
try {
73627362
createPath(file); // make sure the path exists
7363-
FileOutputStream fos = new FileOutputStream(file);
7363+
OutputStream output =
7364+
new BufferedOutputStream(new FileOutputStream(file));
73647365
if (file.getName().toLowerCase().endsWith(".gz")) {
7365-
return new GZIPOutputStream(fos);
7366+
return new GZIPOutputStream(output);
73667367
}
7367-
return fos;
7368+
return output;
73687369

73697370
} catch (IOException e) {
73707371
e.printStackTrace();

core/todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ X add sum() to IntDict and FloatDict
44
X add sumLong() to IntList, IntDict (to handle cases outside integer range)
55
X add sumDouble() to FloatList, FloatDict (to handle outside float range)
66
X throw exception when using sum() with numbers that are too large or small
7+
X createInput() and createOutput() now both use buffered streams by default
8+
X createInputRaw() does not, however
79

810

911
gohai

0 commit comments

Comments
 (0)