Class OkHttpResponseBodyResource

java.lang.Object
org.springframework.core.io.AbstractResource
io.freefair.spring.okhttp.OkHttpResponseBodyResource
All Implemented Interfaces:
Closeable, AutoCloseable, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource
Direct Known Subclasses:
OkHttpResponseResource

public class OkHttpResponseBodyResource extends org.springframework.core.io.AbstractResource implements Closeable
  • Constructor Details

  • Method Details

    • getContentAsByteArray

      public byte[] getContentAsByteArray() throws IOException
      Specified by:
      getContentAsByteArray in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getContentAsString

      public String getContentAsString(Charset charset) throws IOException
      Specified by:
      getContentAsString in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getDescription

      Specified by:
      getDescription in interface org.springframework.core.io.Resource
    • getInputStream

      Specified by:
      getInputStream in interface org.springframework.core.io.InputStreamSource
      Throws:
      FileNotFoundException
    • contentLength

      public long contentLength() throws FileNotFoundException
      Specified by:
      contentLength in interface org.springframework.core.io.Resource
      Overrides:
      contentLength in class org.springframework.core.io.AbstractResource
      Throws:
      FileNotFoundException
    • exists

      public boolean exists()
      Specified by:
      exists in interface org.springframework.core.io.Resource
      Overrides:
      exists in class org.springframework.core.io.AbstractResource
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.springframework.core.io.Resource
      Overrides:
      isOpen in class org.springframework.core.io.AbstractResource
    • isReadable

      public boolean isReadable()
      Specified by:
      isReadable in interface org.springframework.core.io.Resource
      Overrides:
      isReadable in class org.springframework.core.io.AbstractResource
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getResponseBody

      @Nullable public ResponseBody getResponseBody()