Mercurial > 510Connectbot
comparison src/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java @ 0:0ce5cc452d02
initial version
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 22 May 2014 10:41:19 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0ce5cc452d02 |
---|---|
1 package com.trilead.ssh2.packets; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 /** | |
6 * PacketChannelWindowAdjust. | |
7 * | |
8 * @author Christian Plattner, plattner@trilead.com | |
9 * @version $Id: PacketChannelWindowAdjust.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ | |
10 */ | |
11 public class PacketChannelWindowAdjust { | |
12 byte[] payload; | |
13 | |
14 public int recipientChannelID; | |
15 public int windowChange; | |
16 | |
17 public PacketChannelWindowAdjust(int recipientChannelID, int windowChange) { | |
18 this.recipientChannelID = recipientChannelID; | |
19 this.windowChange = windowChange; | |
20 } | |
21 | |
22 public PacketChannelWindowAdjust(byte payload[], int off, int len) throws IOException { | |
23 this.payload = new byte[len]; | |
24 System.arraycopy(payload, off, this.payload, 0, len); | |
25 TypesReader tr = new TypesReader(payload, off, len); | |
26 int packet_type = tr.readByte(); | |
27 | |
28 if (packet_type != Packets.SSH_MSG_CHANNEL_WINDOW_ADJUST) | |
29 throw new IOException( | |
30 "This is not a SSH_MSG_CHANNEL_WINDOW_ADJUST! (" | |
31 + packet_type + ")"); | |
32 | |
33 recipientChannelID = tr.readUINT32(); | |
34 windowChange = tr.readUINT32(); | |
35 | |
36 if (tr.remain() != 0) | |
37 throw new IOException("Padding in SSH_MSG_CHANNEL_WINDOW_ADJUST packet!"); | |
38 } | |
39 | |
40 public byte[] getPayload() { | |
41 if (payload == null) { | |
42 TypesWriter tw = new TypesWriter(); | |
43 tw.writeByte(Packets.SSH_MSG_CHANNEL_WINDOW_ADJUST); | |
44 tw.writeUINT32(recipientChannelID); | |
45 tw.writeUINT32(windowChange); | |
46 payload = tw.getBytes(); | |
47 } | |
48 | |
49 return payload; | |
50 } | |
51 } |