public class ByteArrayResource extends AbstractResource<byte[]>
| 构造器和说明 |
|---|
ByteArrayResource(byte[] byteArray)
Create a new
ByteArrayResource. |
ByteArrayResource(byte[] byteArray,
String description)
Create a new
ByteArrayResource with a description. |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
contentLength()
This implementation returns the length of the underlying byte array.
|
boolean |
equals(Object other)
This implementation compares the underlying byte array.
|
boolean |
exists()
This implementation always returns
true. |
byte[] |
getByteArray()
Return the underlying byte array.
|
InputStream |
getInputStream()
This implementation returns a ByteArrayInputStream for the
underlying byte array.
|
byte[] |
getRealResource() |
int |
hashCode()
This implementation returns the hash code based on the
underlying byte array.
|
String |
toString()
This implementation returns a description that includes the passed-in
description, if any. |
isReadable, readableChannelpublic ByteArrayResource(byte[] byteArray)
ByteArrayResource.byteArray - the byte array to wrappublic byte[] getRealResource()
public final byte[] getByteArray()
public boolean exists()
true.exists 在接口中 Resource<byte[]>exists 在类中 AbstractResource<byte[]>public long contentLength()
public InputStream getInputStream() throws IOException
null)FileNotFoundException - if the underlying resource doesn't existIOException - if the content stream could not be openedByteArrayInputStreampublic String toString()
description, if any.public boolean equals(Object other)
equals 在类中 ObjectArrays.equals(byte[], byte[])Copyright © 2019. All rights reserved.