Class ResponseContentBlock

java.lang.Object
com.github.bottomlessarchive.warc.service.content.response.domain.ResponseContentBlock
All Implemented Interfaces:
WarcContentBlock

public class ResponseContentBlock
extends java.lang.Object
implements WarcContentBlock
An implementation of WarcContentBlock interface to handle contents block's of WARC responses.
  • Constructor Summary

    Constructors 
    Constructor Description
    ResponseContentBlock()  
  • Method Summary

    Modifier and Type Method Description
    java.util.Optional<java.nio.charset.Charset> getCharset()
    The charset of the response.
    java.util.Optional<java.lang.String> getHeader​(java.lang.String headerName)
    Return a value of a header from the response.
    java.util.Map<java.lang.String,​java.lang.String> getHeaders()
    Return all of the headers of a WARC response.
    java.lang.String getPayloadAsString()
    Return the payload as a String instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.github.bottomlessarchive.warc.service.content.domain.WarcContentBlock

    getPayload
  • Constructor Details

  • Method Details

    • getHeader

      public java.util.Optional<java.lang.String> getHeader​(java.lang.String headerName)
      Return a value of a header from the response.
      Parameters:
      headerName - the name of the header to get the value for
      Returns:
      the value of the header
    • getHeaders

      public java.util.Map<java.lang.String,​java.lang.String> getHeaders()
      Return all of the headers of a WARC response.
      Returns:
      the headers of the response
    • getCharset

      public java.util.Optional<java.nio.charset.Charset> getCharset()
      The charset of the response. If the mime type of the response is not text then this field is null.
      Returns:
      return the charset of the response content
    • getPayloadAsString

      public java.lang.String getPayloadAsString()
      Return the payload as a String instance. After this method is called consider the payload of this content block fully read. Any further read on the payload will raise an exception.
      Returns:
      the payload of the content block as string