类 ByteArrayResource

java.lang.Object
cn.taketoday.core.io.AbstractResource
cn.taketoday.core.io.ByteArrayResource
所有已实现的接口:
InputStreamSource, Resource

public class ByteArrayResource extends AbstractResource
Resource implementation for a given byte array.

Creates a ByteArrayInputStream for the given byte array.

Useful for loading content from any given byte array, without having to resort to a single-use InputStreamResource. Particularly useful for creating mail attachments from local content, where JavaMail needs to be able to read the stream multiple times.

从以下版本开始:
3.0
作者:
Juergen Hoeller, Sam Brannen, TODAY 2021/3/7 11:16
另请参阅:
  • 字段详细资料

    • byteArray

      private final byte[] byteArray
    • description

      private final String description
  • 构造器详细资料

    • ByteArrayResource

      public ByteArrayResource(byte[] byteArray)
      Create a new ByteArrayResource.
      参数:
      byteArray - the byte array to wrap
    • ByteArrayResource

      public ByteArrayResource(byte[] byteArray, String description)
      Create a new ByteArrayResource with a description.
      参数:
      byteArray - the byte array to wrap
      description - where the byte array comes from
  • 方法详细资料