From 51f1442bb96ff1db3e6c3d09342fc59bc17b5bb9 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Mon, 1 Jun 2009 00:59:33 +0000 Subject: Reduce allocations in read and write path, pass 1 (there is still more allocation badness in insertLine to take care of) git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@252 df292f66-193f-0410-a5fc-6d59da041ff2 --- .../main/java/com/trilead/ssh2/channel/ChannelOutputStream.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/src/main/java/com') diff --git a/lib/src/main/java/com/trilead/ssh2/channel/ChannelOutputStream.java b/lib/src/main/java/com/trilead/ssh2/channel/ChannelOutputStream.java index 3fd7214..30e8fd8 100644 --- a/lib/src/main/java/com/trilead/ssh2/channel/ChannelOutputStream.java +++ b/lib/src/main/java/com/trilead/ssh2/channel/ChannelOutputStream.java @@ -13,20 +13,21 @@ public final class ChannelOutputStream extends OutputStream { Channel c; + private byte[] writeBuffer; + boolean isClosed = false; ChannelOutputStream(Channel c) { this.c = c; + writeBuffer = new byte[1]; } public void write(int b) throws IOException { - byte[] buff = new byte[1]; - - buff[0] = (byte) b; + writeBuffer[0] = (byte) b; - write(buff, 0, 1); + write(writeBuffer, 0, 1); } public void close() throws IOException -- cgit v1.2.3