public class ByteArrayResource extends AbstractResource
Resource
実装。 指定されたバイト配列の ByteArrayInputStream
SE を作成します。
特定のバイト配列からコンテンツをロードするのに便利で、使い捨ての InputStreamResource
に頼る必要はありません。JavaMail がストリームを複数回読み取ることができる必要があるローカルコンテンツからメール添付ファイルを作成するのに特に便利です。
ByteArrayInputStream
SE, InputStreamResource
, MimeMessageHelper.addAttachment(String, InputStreamSource)
コンストラクターと説明 |
---|
ByteArrayResource(byte[] byteArray) 新しい ByteArrayResource を作成します。 |
ByteArrayResource(byte[] byteArray, StringSE description) 説明付きの新しい ByteArrayResource を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
long | contentLength() この実装は、基礎となるバイト配列の長さを返します。 |
boolean | equals(ObjectSE other) この実装は、基礎となるバイト配列を比較します。 |
boolean | exists() この実装は、常に true を返します。 |
byte[] | getByteArray() 基になるバイト配列を返します。 |
StringSE | getDescription() この実装は、もしあれば、渡された description を含む記述を返します。 |
InputStreamSE | getInputStream() この実装は、基になるバイト配列の ByteArrayInputStream を返します。 |
int | hashCode() この実装は、基礎となるバイト配列に基づいてハッシュコードを返します。 |
createRelative, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, isFile, isOpen, isReadable, lastModified, readableChannel, toString
cloneSE, finalizeSE, getClassSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public ByteArrayResource(byte[] byteArray)
ByteArrayResource
を作成します。byteArray
- ラップするバイト配列 public final byte[] getByteArray()
public boolean exists()
true
を返します。Resource
の exists
AbstractResource
の exists
public long contentLength()
Resource
の contentLength
AbstractResource
の contentLength
InputStreamSource.getInputStream()
public InputStreamSE getInputStream() throws IOExceptionSE
null
であってはなりません)FileNotFoundExceptionSE
- 基盤となるリソースが存在しない場合 IOExceptionSE
- コンテンツストリームを開けなかった場合 ByteArrayInputStream
SEpublic StringSE getDescription()
description
を含む記述を返します。Object.toString()
SEpublic boolean equals(@Nullable ObjectSE other)
AbstractResource
の equals
Arrays.equals(byte[], byte[])
SEpublic int hashCode()
AbstractResource
の hashCode
Resource.getDescription()