public class ResizableByteArrayOutputStream
extends java.io.ByteArrayOutputStream
ByteArrayOutputStream
の拡張機能:grow(int)
および resize(int)
メソッドがあります 4.2 の時点で、ByteArrayOutputStream
への割り当てが不要な Spring の内部使用のために、このクラスは FastByteArrayOutputStream
に置き換えられました(FastByteArrayOutputStream
はバッファーサイズ変更管理でより効率的ですが、標準の ByteArrayOutputStream
を継承しないため)。
resize(int)
, FastByteArrayOutputStream
コンストラクターと説明 |
---|
ResizableByteArrayOutputStream() 256 バイトのデフォルトの初期容量で新しい ResizableByteArrayOutputStream を作成します。 |
ResizableByteArrayOutputStream(int initialCapacity) 指定された初期容量で新しい ResizableByteArrayOutputStream を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
int | capacity() このストリームの内部バッファの現在のサイズを返します。 |
void | grow(int additionalCapacity) 内部バッファサイズを増やします。 |
void | resize(int targetCapacity) 内部バッファのサイズを指定された容量に変更します。 |
public ResizableByteArrayOutputStream()
ResizableByteArrayOutputStream
を作成します。public ResizableByteArrayOutputStream(int initialCapacity)
ResizableByteArrayOutputStream
を作成します。initialCapacity
- バイト単位の初期バッファサイズ public void resize(int targetCapacity)
targetCapacity
- 必要なバッファのサイズ java.lang.IllegalArgumentException
- 指定された容量が、すでにバッファに保存されているコンテンツの実際のサイズよりも小さい場合 ByteArrayOutputStream.size()
public void grow(int additionalCapacity)
additionalCapacity
- 現在のバッファサイズに追加するバイト数 ByteArrayOutputStream.size()
public int capacity()