diff options
author | Kenny Root <kenny@the-b.org> | 2013-04-11 21:01:32 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2013-04-11 21:01:32 -0700 |
commit | d8e49ec3f297f9ba0991762eb2cddbc00ed634d2 (patch) | |
tree | aac59c707c980e90202241c7a9c306ab9d278a1c /src/com/trilead/ssh2/channel/ChannelInputStream.java | |
parent | 847af5046fb7d2dbcc668cecf81f1726b7c48bd9 (diff) | |
download | connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.tar.gz connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.tar.bz2 connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.zip |
Fix line endings
Diffstat (limited to 'src/com/trilead/ssh2/channel/ChannelInputStream.java')
-rw-r--r-- | src/com/trilead/ssh2/channel/ChannelInputStream.java | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/src/com/trilead/ssh2/channel/ChannelInputStream.java b/src/com/trilead/ssh2/channel/ChannelInputStream.java index a6d936f..f88522c 100644 --- a/src/com/trilead/ssh2/channel/ChannelInputStream.java +++ b/src/com/trilead/ssh2/channel/ChannelInputStream.java @@ -1,86 +1,86 @@ -
-package com.trilead.ssh2.channel;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * ChannelInputStream.
- *
- * @author Christian Plattner, plattner@trilead.com
- * @version $Id: ChannelInputStream.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
- */
-public final class ChannelInputStream extends InputStream
-{
- Channel c;
-
- boolean isClosed = false;
- boolean isEOF = false;
- boolean extendedFlag = false;
-
- ChannelInputStream(Channel c, boolean isExtended)
- {
- this.c = c;
- this.extendedFlag = isExtended;
- }
-
- public int available() throws IOException
- {
- if (isEOF)
- return 0;
-
- int avail = c.cm.getAvailable(c, extendedFlag);
-
- /* We must not return -1 on EOF */
-
- return (avail > 0) ? avail : 0;
- }
-
- public void close() throws IOException
- {
- isClosed = true;
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (b == null)
- throw new NullPointerException();
-
- if ((off < 0) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0) || (off > b.length))
- throw new IndexOutOfBoundsException();
-
- if (len == 0)
- return 0;
-
- if (isEOF)
- return -1;
-
- int ret = c.cm.getChannelData(c, extendedFlag, b, off, len);
-
- if (ret == -1)
- {
- isEOF = true;
- }
-
- return ret;
- }
-
- public int read(byte[] b) throws IOException
- {
- return read(b, 0, b.length);
- }
-
- public int read() throws IOException
- {
- /* Yes, this stream is pure and unbuffered, a single byte read() is slow */
-
- final byte b[] = new byte[1];
-
- int ret = read(b, 0, 1);
-
- if (ret != 1)
- return -1;
-
- return b[0] & 0xff;
- }
-}
+ +package com.trilead.ssh2.channel; + +import java.io.IOException; +import java.io.InputStream; + +/** + * ChannelInputStream. + * + * @author Christian Plattner, plattner@trilead.com + * @version $Id: ChannelInputStream.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $ + */ +public final class ChannelInputStream extends InputStream +{ + Channel c; + + boolean isClosed = false; + boolean isEOF = false; + boolean extendedFlag = false; + + ChannelInputStream(Channel c, boolean isExtended) + { + this.c = c; + this.extendedFlag = isExtended; + } + + public int available() throws IOException + { + if (isEOF) + return 0; + + int avail = c.cm.getAvailable(c, extendedFlag); + + /* We must not return -1 on EOF */ + + return (avail > 0) ? avail : 0; + } + + public void close() throws IOException + { + isClosed = true; + } + + public int read(byte[] b, int off, int len) throws IOException + { + if (b == null) + throw new NullPointerException(); + + if ((off < 0) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0) || (off > b.length)) + throw new IndexOutOfBoundsException(); + + if (len == 0) + return 0; + + if (isEOF) + return -1; + + int ret = c.cm.getChannelData(c, extendedFlag, b, off, len); + + if (ret == -1) + { + isEOF = true; + } + + return ret; + } + + public int read(byte[] b) throws IOException + { + return read(b, 0, b.length); + } + + public int read() throws IOException + { + /* Yes, this stream is pure and unbuffered, a single byte read() is slow */ + + final byte b[] = new byte[1]; + + int ret = read(b, 0, 1); + + if (ret != 1) + return -1; + + return b[0] & 0xff; + } +} |