所有已知实现类:
InspectedContent, Layer

public interface Content
Content with a known size that can be written to an OutputStream.
从以下版本开始:
2.3.0
作者:
Phillip Webb
  • 方法详细资料

    • size

      int size()
      The size of the content in bytes.
      返回:
      the content size
    • writeTo

      void writeTo(OutputStream outputStream) throws IOException
      Write the content to the given output stream.
      参数:
      outputStream - the output stream to write to
      抛出:
      IOException - on IO error
    • of

      static Content of(String string)
      Create a new Content from the given UTF-8 string.
      参数:
      string - the string to write
      返回:
      a new Content instance
    • of

      static Content of(byte[] bytes)
      Create a new Content from the given input stream.
      参数:
      bytes - the bytes to write
      返回:
      a new Content instance
    • of

      static Content of(File file)
      Create a new Content from the given file.
      参数:
      file - the file to write
      返回:
      a new Content instance
    • of

      static Content of(int size, IOSupplier<InputStream> supplier)
      Create a new Content from the given input stream. The stream will be closed after it has been written.
      参数:
      size - the size of the supplied input stream
      supplier - the input stream supplier
      返回:
      a new Content instance