public byte[] getPayload() { if (payload == null) { TypesWriter tw = new TypesWriter(); tw.writeByte(Packets.SSH_MSG_DISCONNECT); tw.writeUINT32(reason); tw.writeString(desc); tw.writeString(lang); payload = tw.getBytes(); } return payload; }
public void writeMPInt(BigInteger b) { byte raw[] = b.toByteArray(); if ((raw.length == 1) && (raw[0] == 0)) writeUINT32(0); /* String with zero bytes of data */ else writeString(raw, 0, raw.length); }
public void writeUINT32(int val) { writeUINT32(val, pos); pos += 4; }
public void writeString(String v, String charsetName) throws UnsupportedEncodingException { byte[] b = (charsetName == null) ? v.getBytes() : v.getBytes(charsetName); writeUINT32(b.length); writeBytes(b, 0, b.length); }
public void writeString(String v) { byte[] b = v.getBytes(); writeUINT32(b.length); writeBytes(b, 0, b.length); }
public void writeString(byte[] buff, int off, int len) { writeUINT32(len); writeBytes(buff, off, len); }