[Esbox-commits] r874 - trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh

eswartz at garage.maemo.org eswartz at garage.maemo.org
Wed Oct 15 21:38:17 EEST 2008


Author: eswartz
Date: 2008-10-15 21:38:17 +0300 (Wed, 15 Oct 2008)
New Revision: 874

Modified:
   trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java
Log:
Fix broken SB2 qemu stream wrapper (dunno why I didn't catch this :9)

Modified: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java	2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java	2008-10-15 18:38:17 UTC (rev 874)
@@ -115,6 +115,23 @@
 					} while (true);
 				}
 				
+				/* (non-Javadoc)
+				 * @see java.io.FilterInputStream#read(byte[], int, int)
+				 */
+				@Override
+				public int read(byte[] b, int off, int len) throws IOException {
+					int cnt = 0;
+					while (cnt < len) {
+						int ch = read();
+						if (ch < 0)
+							break;
+						b[off + cnt++] = (byte) ch;
+						if (ch == '\n')
+							break;
+					}
+					return cnt; 
+				}
+				
 			};
 		}
 		
@@ -129,6 +146,22 @@
 					return in.read();
 				}
 				
+				/* (non-Javadoc)
+				 * @see java.io.FilterInputStream#read(byte[], int, int)
+				 */
+				@Override
+				public int read(byte[] b, int off, int len) throws IOException {
+					int cnt = 0;
+					while (cnt < len) {
+						int ch = read();
+						if (ch < 0)
+							break;
+						b[off + cnt++] = (byte) ch;
+						if (ch == '\n')
+							break;
+					}
+					return cnt; 
+				}
 			};
 		}
 		



More information about the Esbox-commits mailing list