public abstract class StreamUtils extends ObjectSE
FileCopyUtils
で定義されているものと似ています。すべてのコピー方法は、4096 バイトのブロックサイズを使用します。主にフレームワーク内で使用しますが、アプリケーションコードにも役立ちます。
FileCopyUtils
修飾子と型 | フィールドと説明 |
---|---|
static int | BUFFER_SIZE デフォルトのバッファサイズは、バイトをコピーする理由を使用します。 |
コンストラクターと説明 |
---|
StreamUtils() |
修飾子と型 | メソッドと説明 |
---|---|
static void | copy(byte[] in, OutputStreamSE out) 指定されたバイト配列の内容を指定された OutputStream にコピーします。 |
static int | copy(InputStreamSE in, OutputStreamSE out) 指定された InputStream の内容を指定された OutputStream にコピーします。 |
static void | copy(StringSE in, CharsetSE charset, OutputStreamSE out) 指定された文字列の内容を指定された出力 OutputStream にコピーします。 |
static long | copyRange(InputStreamSE in, OutputStreamSE out, long start, long end) 特定の InputStream のコンテンツの範囲を特定の OutputStream にコピーします。 |
static byte[] | copyToByteArray(InputStreamSE in) 指定された InputStream の内容を新しいバイト配列にコピーします。 |
static StringSE | copyToString(InputStreamSE in, CharsetSE charset) 指定された InputStream の内容を文字列にコピーします。 |
static int | drain(InputStreamSE in) 指定された InputStream の残りのコンテンツを排出します。 |
static InputStreamSE | emptyInput() 効率的な空の InputStream SE を返します。 |
static InputStreamSE | nonClosing(InputStreamSE in) close() SE を呼び出しても効果がない、指定された InputStream SE のバリアントを返します。 |
static OutputStreamSE | nonClosing(OutputStreamSE out) close() SE を呼び出しても効果がない、指定された OutputStream SE のバリアントを返します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static final int BUFFER_SIZE
public static byte[] copyToByteArray(@Nullable InputStreamSE in) throws IOExceptionSE
in
- コピー元のストリーム (null
または空の場合があります)IOExceptionSE
- I/O エラーの場合 public static StringSE copyToString(@Nullable InputStreamSE in, CharsetSE charset) throws IOExceptionSE
in
- コピー元の InputStream (null
または空の場合があります)IOExceptionSE
- I/O エラーの場合 public static void copy(byte[] in, OutputStreamSE out) throws IOExceptionSE
in
- コピー元のバイト配列 out
- コピー先の OutputStreamIOExceptionSE
- I/O エラーの場合 public static void copy(StringSE in, CharsetSE charset, OutputStreamSE out) throws IOExceptionSE
in
- コピー元の文字列 charset
- 文字セット out
- コピー先の OutputStreamIOExceptionSE
- I/O エラーの場合 public static int copy(InputStreamSE in, OutputStreamSE out) throws IOExceptionSE
in
- コピー元の InputStreamout
- コピー先の OutputStreamIOExceptionSE
- I/O エラーの場合 public static long copyRange(InputStreamSE in, OutputStreamSE out, long start, long end) throws IOExceptionSE
指定された範囲が InputStream の長さを超える場合、これはストリームの最後までコピーし、コピーされた実際のバイト数を返します。
完了したら、両方のストリームを開いたままにします。
in
- コピー元の InputStreamout
- コピー先の OutputStreamstart
- コピーを開始する位置 end
- コピーを終了する位置 IOExceptionSE
- I/O エラーの場合 public static int drain(InputStreamSE in) throws IOExceptionSE
in
- InputStream を排出する IOExceptionSE
- I/O エラーの場合 public static InputStreamSE emptyInput()
InputStream
SE を返します。ByteArrayInputStream
SEpublic static InputStreamSE nonClosing(InputStreamSE in)
close()
SE を呼び出しても効果がない、指定された InputStream
SE のバリアントを返します。in
- InputStream を飾る public static OutputStreamSE nonClosing(OutputStreamSE out)
close()
SE を呼び出しても効果がない、指定された OutputStream
SE のバリアントを返します。out
- OutputStream を飾る