aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2009-06-01 00:59:33 +0000
committerKenny Root <kenny@the-b.org>2009-06-01 00:59:33 +0000
commit51f1442bb96ff1db3e6c3d09342fc59bc17b5bb9 (patch)
treeb22d68ba301b971e74ef3b4d977dcf48c3044773
parente7d0162a3cb5d8cb2b4807bf3ddbf073c65480b0 (diff)
downloadsshlib-51f1442bb96ff1db3e6c3d09342fc59bc17b5bb9.tar.gz
sshlib-51f1442bb96ff1db3e6c3d09342fc59bc17b5bb9.tar.bz2
sshlib-51f1442bb96ff1db3e6c3d09342fc59bc17b5bb9.zip
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
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/ChannelOutputStream.java9
1 files changed, 5 insertions, 4 deletions
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