public class ByteArrayStream extends ByteArrayOutputStream
buf, count
Constructor and Description |
---|
ByteArrayStream() |
ByteArrayStream(int size) |
Modifier and Type | Method and Description |
---|---|
ByteArrayInputStream |
asInputStream()
All data previously written.
|
void |
copyTo(byte[] target,
int offset)
Copy all data to the target
|
void |
reset() |
Signature |
sign(I2PAppContext ctx,
SigningPrivateKey signingKey)
Sign the written data
|
Signature |
sign(SigningPrivateKey signingKey)
Sign the written data
|
byte[] |
toByteArray()
Zero-copy only if the data fills the buffer.
|
boolean |
verifySignature(I2PAppContext ctx,
Signature signature,
SigningPublicKey verifyingKey)
Verify the written data
|
boolean |
verifySignature(Signature signature,
SigningPublicKey verifyingKey)
Verify the written data
|
close, size, toString, toString, toString, write, write, writeTo
flush, write
public ByteArrayStream()
public ByteArrayStream(int size)
size
- if accurate, toByteArray() will be zero-copypublic void reset()
reset
in class ByteArrayOutputStream
IllegalStateException
- if previously writtenpublic byte[] toByteArray()
toByteArray
in class ByteArrayOutputStream
public ByteArrayInputStream asInputStream()
public void copyTo(byte[] target, int offset)
public boolean verifySignature(Signature signature, SigningPublicKey verifyingKey)
public boolean verifySignature(I2PAppContext ctx, Signature signature, SigningPublicKey verifyingKey)
public Signature sign(SigningPrivateKey signingKey)
public Signature sign(I2PAppContext ctx, SigningPrivateKey signingKey)