public class ByteArrayResource extends AbstractResource<byte[]> implements Locatable
| 构造器和说明 |
|---|
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. |
String |
getAbsolutePath() |
byte[] |
getByteArray()
Return the underlying byte array.
|
String |
getDescription() |
InputStream |
getInputStream()
This implementation returns a ByteArrayInputStream for the
underlying byte array.
|
Location |
getLocation() |
String |
getPath() |
String |
getPrefix() |
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 String getDescription()
public Location getLocation()
getLocation 在接口中 Locatablepublic String getAbsolutePath()
getAbsolutePath 在接口中 Locatablepublic byte[] getRealResource()
getRealResource 在接口中 Resource<byte[]>public final byte[] getByteArray()
public boolean exists()
true.exists 在接口中 Resource<byte[]>exists 在类中 AbstractResource<byte[]>public long contentLength()
contentLength 在接口中 Resource<byte[]>public InputStream getInputStream() throws IOException
getInputStream 在接口中 Resource<byte[]>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 © 2021. All rights reserved.