public class DLOctetStringGenerator extends DLGenerator
getOctetOutputStream(), which enforces the count — writing past it
fails immediately, and close() fails if it was not reached. The
count is a long, so content larger than a Java array can carry is
supported.
The result is a single primitive OCTET STRING (as DER requires), in
contrast to BEROctetStringGenerator's indefinite-length constructed
chunking.
_out| Constructor and Description |
|---|
DLOctetStringGenerator(java.io.OutputStream out,
int tagNo,
boolean isExplicit,
long octetCount)
Use the passed in stream as the target for the generator, writing out
the header for a tagged definite-length OCTET STRING (primitive when
implicit, per X.690 8.14.3).
|
DLOctetStringGenerator(java.io.OutputStream out,
long octetCount)
Use the passed in stream as the target for the generator, writing out
the header for a definite-length primitive OCTET STRING.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Verify the declared octet count was written in full.
|
java.io.OutputStream |
getOctetOutputStream()
Return the content target for this OCTET STRING.
|
getDLEncodingLength, getLengthOctetCount, getRawOutputStream, writeDLHeaderpublic DLOctetStringGenerator(java.io.OutputStream out,
long octetCount)
throws java.io.IOException
out - target streamoctetCount - the exact number of octets that will be writtenjava.io.IOException - if the target stream cannot be written to.public DLOctetStringGenerator(java.io.OutputStream out,
int tagNo,
boolean isExplicit,
long octetCount)
throws java.io.IOException
out - target streamtagNo - the tag number to introduceisExplicit - true if this is an explicitly tagged object, false otherwise.octetCount - the exact number of octets that will be writtenjava.io.IOException - if the target stream cannot be written to.public java.io.OutputStream getOctetOutputStream()
public void close()
throws java.io.IOException
java.io.IOException - if fewer octets were written than declared.