Top Description Inners Constructors Methods
org.bouncycastle.asn1

public Class BEROctetStringGenerator

extends BERGenerator
Class Inheritance
Imports
java.io.IOException, .OutputStream

A generator for indefinite-length OCTET STRINGs

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Constructor Summary

AccessConstructor and Description
public
BEROctetStringGenerator(OutputStream
target stream
out
)

Use the passed in stream as the target for the generator, writing out the header tag for a constructed OCTET STRING.

public
BEROctetStringGenerator(OutputStream
target stream
out
,
int
the tag number to introduce
tagNo
,
boolean
true if this is an explicitly tagged object, false otherwise.
isExplicit
)

Use the passed in stream as the target for the generator, writing out the header tag for a tagged constructed OCTET STRING (possibly implicit).

Method Summary

Modifier and TypeMethod and Description
public OutputStream

Returns:

an OutputStream which chunks data in blocks of 1000 (CER limit).
getOctetOutputStream
()

Return a stream representing the content target for this OCTET STRING

public OutputStream

Returns:

an OutputStream which chunks data in blocks of buf length.
getOctetOutputStream
(byte[]
the buffer to use for chunking the data.
buf
)

Return a stream representing the content target for this OCTET STRING

Inherited from org.bouncycastle.asn1.BERGenerator:
getRawOutputStreamwriteBEREndwriteBERHeader

Constructor Detail

BEROctetStringGeneratorback to summary
public BEROctetStringGenerator(OutputStream out) throws IOException

Use the passed in stream as the target for the generator, writing out the header tag for a constructed OCTET STRING.

Parameters
out:OutputStream

target stream

Exceptions
IOException:
if the target stream cannot be written to.
BEROctetStringGeneratorback to summary
public BEROctetStringGenerator(OutputStream out, int tagNo, boolean isExplicit) throws IOException

Use the passed in stream as the target for the generator, writing out the header tag for a tagged constructed OCTET STRING (possibly implicit).

Parameters
out:OutputStream

target stream

tagNo:int

the tag number to introduce

isExplicit:boolean

true if this is an explicitly tagged object, false otherwise.

Exceptions
IOException:
if the target stream cannot be written to.

Method Detail

getOctetOutputStreamback to summary
public OutputStream getOctetOutputStream()

Return a stream representing the content target for this OCTET STRING

Returns:OutputStream

an OutputStream which chunks data in blocks of 1000 (CER limit).

getOctetOutputStreamback to summary
public OutputStream getOctetOutputStream(byte[] buf)

Return a stream representing the content target for this OCTET STRING

Parameters
buf:byte[]

the buffer to use for chunking the data.

Returns:OutputStream

an OutputStream which chunks data in blocks of buf length.

org.bouncycastle.asn1 back to summary

private Class BEROctetStringGenerator.BufferedBEROctetStream

extends OutputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private byte[]
private DEROutputStream
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with this stream.

public void
write(int
the byte.
b
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.

public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Inherited from java.io.OutputStream:
flushnullOutputStreamwrite

Field Detail

_bufback to summary
private byte[] _buf
_derOutback to summary
private DEROutputStream _derOut
_offback to summary
private int _off

Constructor Detail

BufferedBEROctetStreamback to summary
pack-priv BufferedBEROctetStream(byte[] buf)

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.OutputStream.close.

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.