public class ByteArrayStream extends ByteArrayOutputStream
buf, count| Constructor and Description |
|---|
ByteArrayStream()Creates a new byte array output stream. |
ByteArrayStream(int size)Creates a new byte array output stream with the specified size. |
| Modifier and Type | Method and Description |
|---|---|
ByteArrayInputStream | asInputStream()Creates an input stream from the written data. |
void | copyTo(byte[] target,
int offset)Copies all written data to the target array. |
void | reset()Resets this stream to the beginning. |
Signature | sign(I2PAppContext ctx,
SigningPrivateKey signingKey)Signs the written data. |
Signature | sign(SigningPrivateKey signingKey)Signs the written data. |
byte[] | toByteArray()Returns the byte array containing the written data. |
boolean | verifySignature(I2PAppContext ctx,
Signature signature,
SigningPublicKey verifyingKey)Verifies the signature of the written data. |
boolean | verifySignature(Signature signature,
SigningPublicKey verifyingKey)Verifies the signature of the written data. |
close, size, toString, toString, toString, write, write, writeToflush, writepublic ByteArrayStream()
public ByteArrayStream(int size)
size - the initial size of the internal bufferpublic ByteArrayInputStream asInputStream()
public void copyTo(byte[] target,
int offset)target - the targetoffset - the offset in the target arraypublic void reset()
reset in class ByteArrayOutputStreamIllegalStateException - if previously writtenpublic Signature sign(I2PAppContext ctx, SigningPrivateKey signingKey)
ctx - the application contextsigningKey - the private key to sign withpublic Signature sign(SigningPrivateKey signingKey)
signingKey - the private key to sign withpublic byte[] toByteArray()
toByteArray in class ByteArrayOutputStreampublic boolean verifySignature(I2PAppContext ctx, Signature signature, SigningPublicKey verifyingKey)
ctx - the application contextsignature - the signature to verifyverifyingKey - the public key to verify withpublic boolean verifySignature(Signature signature, SigningPublicKey verifyingKey)
signature - the signature to verifyverifyingKey - the public key to verify with