APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class AEADBufferedStream

extends ByteArrayOutputStream
Class Inheritance
Imports
jdk.internal.util.ArraysSupport, java.io.ByteArrayOutputStream, java.nio.ByteBuffer, java.util.Arrays, .HexFormat

This class extends ByteArrayOutputStream by optimizing internal buffering. It skips bounds checking, as the buffers are known and input previously checked. toByteArray() returns the internal buffer to avoid an extra copy. This uses `count` to determine the state of `buf`. `buf` can still point to an array while `count` equals zero.

Field Summary

Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
public
AEADBufferedStream(int len)

Create an instance with the specified buffer

Method Summary

Modifier and TypeMethod and Description
private void
checkCapacity(int
length to add to the current buffer
len
)

This method with expand the buffer if count + len is larger than the buffer byte[] length.

public byte[]

Returns:

internal buffer.
getBuffer
()

This method saves memory by returning the internal buffer.

public String
toString()

Overrides java.io.ByteArrayOutputStream.toString.

Converts the buffer's contents into a string decoding bytes using the default charset.

public void
write(ByteBuffer
remaining non-blocksize ByteBuffer
src
)

Takes a ByteBuffer writing non-blocksize data directly to the internal buffer.

public void
write(byte[] in, int offset, int len)

Overrides java.io.ByteArrayOutputStream.write.

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

Inherited from java.io.ByteArrayOutputStream:
closeresetsizetoByteArraytoStringtoStringtoStringwritewriteByteswriteTo

Constructor Detail

AEADBufferedStreamback to summary
public AEADBufferedStream(int len)

Create an instance with the specified buffer

Method Detail

checkCapacityback to summary
private void checkCapacity(int len)

This method with expand the buffer if count + len is larger than the buffer byte[] length.

Parameters
len:int

length to add to the current buffer

getBufferback to summary
public byte[] getBuffer()

This method saves memory by returning the internal buffer. The calling method must use size() for the relevant data length as the returning byte[] maybe larger.

Returns:byte[]

internal buffer.

toStringback to summary
public String toString()

Overrides java.io.ByteArrayOutputStream.toString.

Doc from java.io.ByteArrayOutputStream.toString.

Converts the buffer's contents into a string decoding bytes using the default charset. The length of the new String is a function of the charset, and hence may not be equal to the size of the buffer.

This method always replaces malformed-input and unmappable-character sequences with the default replacement string for the default charset. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required.

Annotations
@Override
writeback to summary
public void write(ByteBuffer src)

Takes a ByteBuffer writing non-blocksize data directly to the internal buffer.

Parameters
src:ByteBuffer

remaining non-blocksize ByteBuffer

writeback to summary
public void write(byte[] in, int offset, int len)

Overrides java.io.ByteArrayOutputStream.write.

Doc from java.io.ByteArrayOutputStream.write.

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

Annotations
@Override