Mercurial > 510Connectbot
comparison app/src/main/java/ch/ethz/ssh2/packets/PacketServiceAccept.java @ 438:d29cce60f393
migrate from Eclipse to Android Studio
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 03 Dec 2015 11:23:55 -0800 |
parents | src/ch/ethz/ssh2/packets/PacketServiceAccept.java@071eccdff8ea |
children |
comparison
equal
deleted
inserted
replaced
437:208b31032318 | 438:d29cce60f393 |
---|---|
1 /* | |
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved. | |
3 * Please refer to the LICENSE.txt for licensing details. | |
4 */ | |
5 package ch.ethz.ssh2.packets; | |
6 | |
7 import java.io.IOException; | |
8 | |
9 import ch.ethz.ssh2.PacketTypeException; | |
10 | |
11 /** | |
12 * @author Christian Plattner | |
13 * @version $Id: PacketServiceAccept.java 160 2014-05-01 14:30:26Z dkocher@sudo.ch $ | |
14 */ | |
15 public final class PacketServiceAccept { | |
16 private final byte[] payload; | |
17 | |
18 public PacketServiceAccept(String serviceName) { | |
19 TypesWriter tw = new TypesWriter(); | |
20 tw.writeByte(Packets.SSH_MSG_SERVICE_ACCEPT); | |
21 tw.writeString(serviceName); | |
22 payload = tw.getBytes(); | |
23 } | |
24 | |
25 public PacketServiceAccept(byte payload[]) throws IOException { | |
26 this.payload = payload; | |
27 TypesReader tr = new TypesReader(payload); | |
28 int packet_type = tr.readByte(); | |
29 | |
30 if (packet_type != Packets.SSH_MSG_SERVICE_ACCEPT) { | |
31 throw new PacketTypeException(packet_type); | |
32 } | |
33 | |
34 if (tr.remain() != 0) { | |
35 String serviceName = tr.readString(); | |
36 } | |
37 } | |
38 | |
39 public byte[] getPayload() { | |
40 return payload; | |
41 } | |
42 } |