public abstract class Buffer extends Object implements Readable
Modifier and Type | Field and Description |
---|---|
protected byte[] |
workBuf |
Modifier | Constructor and Description |
---|---|
protected |
Buffer() |
Modifier and Type | Method and Description |
---|---|
abstract byte[] |
array() |
abstract int |
capacity() |
abstract void |
clear() |
abstract void |
compact() |
void |
ensureAvailable(int a) |
protected void |
ensureCapacity(int capacity) |
abstract void |
ensureCapacity(int capacity,
Int2IntFunction growthFactor) |
protected KeyPair |
extractEC(String expectedCurveName,
ECParameterSpec spec) |
Collection<String> |
getAvailableStrings() |
Collection<String> |
getAvailableStrings(Charset charset) |
boolean |
getBoolean() |
byte |
getByte() |
byte[] |
getBytes() |
byte[] |
getCompactData() |
int |
getInt() |
KeyPair |
getKeyPair() |
long |
getLong() |
BigInteger |
getMPInt() |
byte[] |
getMPIntAsBytes() |
PublicKey |
getPublicKey() |
PublicKey |
getPublicKey(BufferPublicKeyParser<? extends PublicKey> parser) |
void |
getRawBytes(byte[] buf) |
PublicKey |
getRawPublicKey() |
PublicKey |
getRawPublicKey(BufferPublicKeyParser<? extends PublicKey> parser) |
short |
getShort() |
String |
getString() |
abstract String |
getString(Charset charset) |
Collection<String> |
getStringList(boolean usePrependedLength) |
Collection<String> |
getStringList(boolean usePrependedLength,
Charset charset) |
List<String> |
getStringList(int count) |
List<String> |
getStringList(int count,
Charset charset) |
int |
getUByte() |
long |
getUInt() |
String |
printHex() |
void |
putBoolean(boolean b) |
void |
putBuffer(Readable buffer) |
abstract int |
putBuffer(Readable buffer,
boolean expand) |
void |
putByte(byte b) |
void |
putBytes(byte[] b) |
void |
putBytes(byte[] b,
int off,
int len) |
void |
putInt(long i)
Writes 32 bits
|
void |
putKeyPair(KeyPair kp) |
void |
putLong(long i)
Writes 64 bits
|
void |
putMPInt(BigInteger bi) |
void |
putMPInt(byte[] foo) |
void |
putPublicKey(PublicKey key) |
void |
putRawBytes(byte[] d) |
abstract void |
putRawBytes(byte[] d,
int off,
int len) |
void |
putRawPublicKey(PublicKey key) |
void |
putShort(int i)
Writes 16 bits
|
void |
putString(String string) |
void |
putString(String string,
Charset charset) |
void |
putStringList(Collection<?> objects,
boolean prependLength)
Encodes the
Transformer.TOSTRING value of each member. |
void |
putStringList(Collection<?> objects,
Charset charset,
boolean prependLength)
Encodes the
Transformer.TOSTRING value of each member |
abstract int |
rpos() |
abstract void |
rpos(int rpos) |
protected abstract int |
size() |
String |
toString() |
abstract int |
wpos() |
abstract void |
wpos(int wpos) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
available, getRawBytes
public abstract int rpos()
public abstract void rpos(int rpos)
public abstract int wpos()
public abstract void wpos(int wpos)
public abstract int capacity()
public abstract byte[] array()
public abstract void compact()
public byte[] getCompactData()
public abstract void clear()
public String printHex()
public int getUByte()
public byte getByte()
public short getShort()
public int getInt()
public long getUInt()
public long getLong()
public boolean getBoolean()
public String getString()
public Collection<String> getStringList(boolean usePrependedLength)
usePrependedLength
- If true
then there is a 32-bit
value indicating the number of strings to read. Otherwise, the
method will use a "greedy" reading of strings while more
data availableCollection
of the read stringsgetStringList(boolean, Charset)
public Collection<String> getStringList(boolean usePrependedLength, Charset charset)
usePrependedLength
- If true
then there is a 32-bit
value indicating the number of strings to read. Otherwise, the
method will use a "greedy" reading of strings while more
data availablecharset
- The Charset
to use for the stringCollection
of the read stringsgetStringList(int, Charset)
,
getAvailableStrings()
public Collection<String> getAvailableStrings()
getAvailableStrings(Charset)
public Collection<String> getAvailableStrings(Charset charset)
charset
- The Charset
to use for the stringsReadable.available()
,
getString(Charset)
public List<String> getStringList(int count)
count
- The exact number of strings to read - can be zeroList
with the specified number of stringsgetStringList(int, Charset)
public List<String> getStringList(int count, Charset charset)
count
- The exact number of strings to read - can be zerocharset
- The Charset
of the stringsList
with the specified number of stringsgetString(Charset)
public BigInteger getMPInt()
public byte[] getMPIntAsBytes()
public byte[] getBytes()
public void getRawBytes(byte[] buf)
public PublicKey getPublicKey() throws SshException
SshException
public PublicKey getPublicKey(BufferPublicKeyParser<? extends PublicKey> parser) throws SshException
parser
- A BufferPublicKeyParser
to extract the key from the buffer
- never null
PublicKey
- may be null
if the parser so decidedSshException
- If failed to extract the keygetRawPublicKey(BufferPublicKeyParser)
public PublicKey getRawPublicKey() throws SshException
SshException
public PublicKey getRawPublicKey(BufferPublicKeyParser<? extends PublicKey> parser) throws SshException
parser
- A BufferPublicKeyParser
to extract the key from the buffer
- never null
PublicKey
- may be null
if the parser so decidedSshException
- If failed to extract the keypublic KeyPair getKeyPair() throws SshException
SshException
protected KeyPair extractEC(String expectedCurveName, ECParameterSpec spec) throws GeneralSecurityException
GeneralSecurityException
public void ensureAvailable(int a) throws BufferException
BufferException
public void putByte(byte b)
public void putBuffer(Readable buffer)
public abstract int putBuffer(Readable buffer, boolean expand)
public void putShort(int i)
i
- The 16-bit valuepublic void putInt(long i)
i
- The 32-bit valuepublic void putLong(long i)
i
- The 64-bit valuepublic void putBoolean(boolean b)
public void putBytes(byte[] b)
public void putBytes(byte[] b, int off, int len)
public void putStringList(Collection<?> objects, boolean prependLength)
Transformer.TOSTRING
value of each member.objects
- The objects to be encoded in the buffer - OK if
null
/emptyprependLength
- If true
then the list is preceded by
a 32-bit count of the number of members in the listputStringList(Collection, Charset, boolean)
public void putStringList(Collection<?> objects, Charset charset, boolean prependLength)
Transformer.TOSTRING
value of each memberobjects
- The objects to be encoded in the buffer - OK if
null
/emptycharset
- The Charset
to use for encodingprependLength
- If true
then the list is preceded by
a 32-bit count of the number of members in the listputString(String, Charset)
public void putString(String string)
public void putMPInt(BigInteger bi)
public void putMPInt(byte[] foo)
public void putRawBytes(byte[] d)
public abstract void putRawBytes(byte[] d, int off, int len)
public void putPublicKey(PublicKey key)
public void putRawPublicKey(PublicKey key)
public void putKeyPair(KeyPair kp)
protected void ensureCapacity(int capacity)
public abstract void ensureCapacity(int capacity, Int2IntFunction growthFactor)
capacity
- The requires capacitygrowthFactor
- An Int2IntFunction
that is invoked
if the current capacity is insufficient. The argument is the minimum
required new data length, the function result should be the
effective new data length to be allocated - if less than minimum
then an exception is thrownprotected abstract int size()
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.