public final class SshBuffer extends Object
Supported data types
BigIntegers| Constructor and Description |
|---|
SshBuffer() |
| Modifier and Type | Method and Description |
|---|---|
void |
appendBigInteger(BigInteger aBigInteger)
Appends an
BigInteger. |
void |
appendByteArray(byte[] aByteArray)
Appends a byte array.
|
void |
appendByteArray(byte[] aByteArray,
int anOffset,
int aLength)
Appends a part/slice of a byte array.
|
void |
appendInt(int anInteger)
Appends an integer value.
|
void |
appendPreamble(String aPreamble)
Appends a preamble.
|
void |
appendString(String aString)
Appends a string.
|
void |
appendStringAndByteArray(String aString,
byte[] aByteArray)
Appends a sequence of a string and a byte array.
|
byte[] |
toByteArray() |
public void appendPreamble(String aPreamble)
Just writes the byte representation of the preamble (ASCII encoded).
Added bytes: number of chars
aPreamble - the preamblepublic void appendString(String aString)
First writes an integer with the length of the string followed by the byte representation of the string (ASCII encoded).
Added bytes: 4 + number of chars
aString - the stringpublic void appendByteArray(byte[] aByteArray)
First writes an integer with the length of the byte array followed by the complete content of the byte array.
Added bytes: 4 + length of the byte array
aByteArray - the byte arraypublic void appendByteArray(byte[] aByteArray,
int anOffset,
int aLength)
First writes an integer with the requested length followed by the requested bytes of the byte array.
Added bytes: 4 + specified length
aByteArray - the byte arrayanOffset - the offsetaLength - the lengthpublic void appendInt(int anInteger)
Integer values are encoded big endian.
Added bytes: 4
anInteger - the integer valuepublic void appendBigInteger(BigInteger aBigInteger)
BigInteger.
Writes the two's-complement representation (big endian encoded).
Added bytes: the minimal number of bytes required to represent this big integer
aBigInteger - the big integerpublic void appendStringAndByteArray(String aString, byte[] aByteArray)
First writes the overall bytes required by this sequence followed by the string and the byte array (each with their length fields as well).
Added bytes: 4 + 4 + number of chars + 4 + length of the byte array
aString - the stringaByteArray - the byte arraypublic byte[] toByteArray()
Copyright © 2023. All rights reserved.