/** * reads some byte from the buffer. * @param foo the array to put the bytes to. This array will * be filled, i.e. we read foo.length bytes from the buffer. */ public void getByte(byte[] foo) { getByte(foo, 0, foo.length); }
public byte[] getString() { int i=getInt(); byte[] foo=new byte[i]; getByte(foo, 0, i); return foo; } byte[] getString(int[]start, int[]len) {
byte[] getString(int[]start, int[]len) { int i=getInt(); start[0]=getByte(i); len[0]=i; return buffer; } public void reset(){
public byte[] getMPInt() { int i = getInt(); // uint32 if (i < 0 || // bigger than 0x7fffffff i > 8 * 1024) { i = 8 * 1024; // the session will be broken, but working around OOME. } byte[] foo = new byte[i]; getByte(foo, 0, i); return foo; }
public byte[] getMPInt() { int i=getInt(); // uint32 if(i<0 || // bigger than 0x7fffffff i>8*1024){ // TODO: an exception should be thrown. i = 8*1024; // the session will be broken, but working around OOME. } byte[] foo=new byte[i]; getByte(foo, 0, i); return foo; } public byte[] getMPIntBits() {
byte[] getString(int[]start, int[]len) { int i=getInt(); start[0]=getByte(i); len[0]=i; return buffer; } public void reset(){
public byte[] getMPInt() { int i=getInt(); byte[] foo=new byte[i]; getByte(foo, 0, i); return foo; } public byte[] getMPIntBits() {
public byte[] getString() { int i = getInt(); // uint32 if(i<0 || // bigger than 0x7fffffff i>256*1024){ // TODO: an exception should be thrown. i = 256*1024; // the session will be broken, but working around OOME. } byte[] foo=new byte[i]; getByte(foo, 0, i); return foo; } byte[] getString(int[]start, int[]len) {
byte[] getString(int[] start, int[] len) { int i = getInt(); start[0] = getByte(i); len[0] = i; return buffer; }
byte[][] getBytes(int n, String msg) throws JSchException { byte[][] tmp = new byte[n][]; for(int i = 0; i < n; i++){ int j = getInt(); if(getLength() < j){ throw new JSchException(msg); } tmp[i] = new byte[j]; getByte(tmp[i]); } return tmp; }
byte[][] getBytes(int n, String msg) throws JSchException { byte[][] tmp = new byte[n][]; for(int i = 0; i < n; i++){ int j = getInt(); if(getLength() < j){ throw new JSchException(msg); } tmp[i] = new byte[j]; getByte(tmp[i]); } return tmp; }
private Header header(Buffer buf, Header header) throws IOException{ buf.rewind(); int i=fill(buf.buffer, 0, 9); header.length=buf.getInt()-5; header.type=buf.getByte()&0xff; header.rid=buf.getInt(); return header; }
private Header header(Buffer buf, Header header) throws IOException { buf.rewind(); int i = fill(buf.buffer, 0, 9); header.length = buf.getInt() - 5; header.type = buf.getByte() & 0xff; header.rid = buf.getInt(); return header; }
private Header header(Buffer buf, Header header) throws IOException{ buf.rewind(); int i=fill(buf.buffer, 0, 9); header.length=buf.getInt()-5; header.type=buf.getByte()&0xff; header.rid=buf.getInt(); return header; }
private Header header(Buffer buf, Header header) throws IOException{ buf.rewind(); int i=fill(buf.buffer, 0, 9); header.length=buf.getInt()-5; header.type=buf.getByte()&0xff; header.rid=buf.getInt(); return header; }