diff options
author | Matthew Johnson <mjj29@qadesh.matthew.ath.cx> | 2009-11-01 12:03:15 +0000 |
---|---|---|
committer | Matthew Johnson <mjj29@qadesh.matthew.ath.cx> | 2009-11-01 12:03:15 +0000 |
commit | 53e9b6f78197c0d9041d4429b1c5e6ec1b90386f (patch) | |
tree | 0400e45a14f33f35f4bc9d63dd660df743f406ac /org | |
parent | 8f029eaa82f1558431b606473ed59b1971d0555b (diff) |
make MessageReader/Writer use buffered streams
Diffstat (limited to 'org')
-rw-r--r-- | org/freedesktop/dbus/MessageReader.java | 5 | ||||
-rw-r--r-- | org/freedesktop/dbus/MessageWriter.java | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/org/freedesktop/dbus/MessageReader.java b/org/freedesktop/dbus/MessageReader.java index 4f1437d..49c69cd 100644 --- a/org/freedesktop/dbus/MessageReader.java +++ b/org/freedesktop/dbus/MessageReader.java @@ -12,9 +12,10 @@ package org.freedesktop.dbus; import static org.freedesktop.dbus.Gettext._; +import java.io.BufferedInputStream; +import java.io.EOFException; import java.io.InputStream; import java.io.IOException; -import java.io.EOFException; import java.net.SocketTimeoutException; import java.text.MessageFormat; @@ -35,7 +36,7 @@ public class MessageReader private int[] len = new int[4]; public MessageReader(InputStream in) { - this.in = in; + this.in = new BufferedInputStream(in); } public Message readMessage() throws IOException, DBusException { diff --git a/org/freedesktop/dbus/MessageWriter.java b/org/freedesktop/dbus/MessageWriter.java index 00fb7f2..e95bf78 100644 --- a/org/freedesktop/dbus/MessageWriter.java +++ b/org/freedesktop/dbus/MessageWriter.java @@ -10,6 +10,7 @@ */ package org.freedesktop.dbus; +import java.io.BufferedOutputStream; import java.io.OutputStream; import java.io.IOException; @@ -23,13 +24,15 @@ public class MessageWriter private boolean isunix; public MessageWriter(OutputStream out) { - this.out = out; + this.out = out; this.isunix = false; try { if (out instanceof USOutputStream) this.isunix = true; } catch (Throwable t) { } + if (!this.isunix) + this.out = new BufferedOutputStream(this.out); } public void writeMessage(Message m) throws IOException { |