Package org.takes.rs

Class RsPrint

  • All Implemented Interfaces:
    org.cactoos.Text, Body, Head, Response

    public final class RsPrint
    extends RsWrap
    implements org.cactoos.Text
    Response decorator that can print an entire response in HTTP format.

    The class is immutable and thread-safe.

    Since:
    0.1
    • Constructor Detail

      • RsPrint

        public RsPrint​(Response res)
        Ctor.
        Parameters:
        res - Original response
    • Method Detail

      • asString

        public String asString()
                        throws Exception
        Specified by:
        asString in interface org.cactoos.Text
        Throws:
        Exception
      • printBody

        public String printBody()
                         throws IOException
        Print body into string.
        Returns:
        Entire body of HTTP response
        Throws:
        IOException - If fails
      • printHead

        public String printHead()
                         throws IOException
        Print head into string.
        Returns:
        Entire head of HTTP response
        Throws:
        IOException - If fails
        Since:
        0.10
      • print

        public void print​(OutputStream output)
                   throws IOException
        Print it into output stream.
        Parameters:
        output - Output to print into
        Throws:
        IOException - If fails
      • printHead

        public void printHead​(OutputStream output)
                       throws IOException
        Print it into output stream.
        Parameters:
        output - Output to print into
        Throws:
        IOException - If fails
        Since:
        0.10
      • printBody

        public void printBody​(OutputStream output)
                       throws IOException
        Print it into output stream.
        Parameters:
        output - Output to print into
        Throws:
        IOException - If fails