|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.schmizz.sshj.common.Buffer<T>
public class Buffer<T extends Buffer<T>>
| Nested Class Summary | |
|---|---|
static class |
Buffer.BufferException
|
static class |
Buffer.PlainBuffer
|
| Field Summary | |
|---|---|
protected byte[] |
data
|
static int |
DEFAULT_SIZE
The default size for a Buffer (256 bytes) |
protected int |
rpos
|
protected int |
wpos
|
| Constructor Summary | |
|---|---|
Buffer()
|
|
Buffer(Buffer<?> from)
|
|
Buffer(byte[] data)
|
|
Buffer(int size)
|
|
| Method Summary | |
|---|---|
byte[] |
array()
|
int |
available()
|
void |
clear()
Resets this buffer. |
void |
compact()
Compact this SSHPacket |
protected void |
ensureAvailable(int a)
|
void |
ensureCapacity(int capacity)
|
byte[] |
getCompactData()
|
protected static int |
getNextPowerOf2(int i)
|
String |
printHex()
Gives a readable snapshot of the buffer in hex. |
T |
putBoolean(boolean b)
Puts an SSH boolean value |
T |
putBuffer(Buffer<? extends Buffer<?>> buffer)
Copies the contents of provided buffer into this buffer |
T |
putByte(byte b)
Writes a single byte into this buffer |
T |
putBytes(byte[] b)
Writes Java byte-array as an SSH byte-array |
T |
putBytes(byte[] b,
int off,
int len)
Writes Java byte-array as an SSH byte-array |
T |
putMPInt(BigInteger bi)
|
T |
putPublicKey(PublicKey key)
|
T |
putRawBytes(byte[] d)
|
T |
putRawBytes(byte[] d,
int off,
int len)
|
T |
putSensitiveString(char[] str)
Writes a char-array as an SSH string and then blanks it out. |
T |
putSignature(String sigFormat,
byte[] sigData)
|
T |
putString(byte[] str)
|
T |
putString(byte[] str,
int offset,
int len)
|
T |
putString(String string)
|
T |
putUInt32(long uint32)
Writes a uint32 integer |
T |
putUInt64(long uint64)
|
boolean |
readBoolean()
Read an SSH boolean byte |
byte |
readByte()
Read a byte from the buffer |
byte[] |
readBytes()
Read an SSH byte-array |
BigInteger |
readMPInt()
Read an SSH multiple-precision integer |
PublicKey |
readPublicKey()
|
void |
readRawBytes(byte[] buf)
|
void |
readRawBytes(byte[] buf,
int off,
int len)
|
String |
readString()
Reads an SSH string |
byte[] |
readStringAsBytes()
Reads an SSH string |
long |
readUInt32()
|
int |
readUInt32AsInt()
|
long |
readUInt64()
|
int |
rpos()
|
void |
rpos(int rpos)
|
String |
toString()
|
int |
wpos()
|
void |
wpos(int wpos)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SIZE
Buffer (256 bytes)
protected byte[] data
protected int rpos
protected int wpos
| Constructor Detail |
|---|
public Buffer()
DEFAULT_SIZEpublic Buffer(Buffer<?> from)
public Buffer(byte[] data)
public Buffer(int size)
| Method Detail |
|---|
protected static int getNextPowerOf2(int i)
public byte[] array()
public int available()
public void clear()
public int rpos()
public void rpos(int rpos)
public int wpos()
public void wpos(int wpos)
protected void ensureAvailable(int a)
throws Buffer.BufferException
Buffer.BufferExceptionpublic void ensureCapacity(int capacity)
public void compact()
SSHPacket
public byte[] getCompactData()
public boolean readBoolean()
throws Buffer.BufferException
true or false value read
Buffer.BufferExceptionpublic T putBoolean(boolean b)
b - the value
public byte readByte()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putByte(byte b)
b -
public byte[] readBytes()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putBytes(byte[] b)
b - Java byte-array
public T putBytes(byte[] b,
int off,
int len)
b - Java byte-arrayoff - offsetlen - length
public void readRawBytes(byte[] buf)
throws Buffer.BufferException
Buffer.BufferException
public void readRawBytes(byte[] buf,
int off,
int len)
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putRawBytes(byte[] d)
public T putRawBytes(byte[] d,
int off,
int len)
public T putBuffer(Buffer<? extends Buffer<?>> buffer)
buffer - the Buffer to copy
public int readUInt32AsInt()
throws Buffer.BufferException
Buffer.BufferException
public long readUInt32()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putUInt32(long uint32)
uint32 -
public BigInteger readMPInt()
throws Buffer.BufferException
BigInteger
Buffer.BufferExceptionpublic T putMPInt(BigInteger bi)
public long readUInt64()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putUInt64(long uint64)
public String readString()
throws Buffer.BufferException
String
Buffer.BufferException
public byte[] readStringAsBytes()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putString(byte[] str)
public T putString(byte[] str,
int offset,
int len)
public T putString(String string)
public T putSensitiveString(char[] str)
str is null, an empty string is
written.
str - (null-ok) the string as a character array
public PublicKey readPublicKey()
throws Buffer.BufferException
Buffer.BufferExceptionpublic T putPublicKey(PublicKey key)
public T putSignature(String sigFormat,
byte[] sigData)
public String printHex()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||