Package ipfs.gomobile.android

## Class RequestBuilder

- java.lang.Object
- - ipfs.gomobile.android.RequestBuilder

-     public class RequestBuilder
      extends java.lang.Object

  RequestBuilder is an IPFS command request builder.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `RequestBuilder.RequestBuilderException` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.io.InputStream` | `send()` | Sends the request to the underlying go-ipfs node and returns an InputStream.
    `byte[]` | `sendToBytes()` | Sends the request to the underlying go-ipfs node and returns a byte array.
    `java.io.File` | `sendToFile​(java.io.File output)` | Sends the request to the underlying go-ipfs node and returns a file containing the response.
    `java.util.ArrayList<org.json.JSONObject>` | `sendToJSONList()` | Sends the request to the underlying go-ipfs node and returns an array of JSONObject.
    `java.io.OutputStream` | `sendToStream​(java.io.OutputStream outStream)` |
    `java.io.OutputStream` | `sendToStream​(java.io.OutputStream outStream, int blockSize)` | Sends the request to the underlying go-ipfs node and writes to the output stream.
    `RequestBuilder` | `withArgument​(java.lang.String argument)` | Adds an argument to the request.
    `RequestBuilder` | `withBody​(byte[] body)` | Adds a byte array body to the request.
    `RequestBuilder` | `withBody​(java.io.File body)` | Adds a file as a body to the request.
    `RequestBuilder` | `withBody​(java.io.InputStream body)` | Adds an InputStream body to the request.
    `RequestBuilder` | `withBody​(java.lang.String body)` | Adds a string body to the request.
    `RequestBuilder` | `withHeader​(java.lang.String key, java.lang.String value)` | Adds a header to the request.
    `RequestBuilder` | `withOption​(java.lang.String option, boolean value)` | Adds a boolean option to the request.
    `RequestBuilder` | `withOption​(java.lang.String option, byte[] value)` | Adds a byte array option to the request.
    `RequestBuilder` | `withOption​(java.lang.String option, java.lang.String value)` | Adds a string option to the request.

    - ### Methods inherited from class java.lang.Object

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

- - ### Method Detail

    - #### send

          public java.io.InputStream send()
                                   throws RequestBuilder.RequestBuilderException

      Sends the request to the underlying go-ipfs node and returns an InputStream.
      Returns:
        An InputStream from which to read the response
      Throws:
        `RequestBuilder.RequestBuilderException` - If sending the request failed
      See Also:
        IPFS API Doc

    - #### sendToBytes

          public byte[] sendToBytes()
                             throws RequestBuilder.RequestBuilderException

      Sends the request to the underlying go-ipfs node and returns a byte array.
      Returns:
        A byte array containing the response
      Throws:
        `RequestBuilder.RequestBuilderException` - If sending the request failed
      See Also:
        IPFS API Doc

    - #### sendToJSONList

          public java.util.ArrayList<org.json.JSONObject> sendToJSONList()
                                                                  throws RequestBuilder.RequestBuilderException,
                                                                         org.json.JSONException

      Sends the request to the underlying go-ipfs node and returns an array of JSONObject.
      Returns:
        An ArrayList of JSONObject generated from the response
      Throws:
        `RequestBuilder.RequestBuilderException` - If sending the request failed
        `org.json.JSONException` - If converting the response to JSONObject failed
      See Also:
        IPFS API Doc

    - #### sendToFile

          public java.io.File sendToFile​(@NonNull
                                         java.io.File output)
                                  throws RequestBuilder.RequestBuilderException,
                                         java.lang.SecurityException,
                                         java.io.IOException

      Sends the request to the underlying go-ipfs node and returns a file containing the response.
      Parameters:
        `output` - The file in which to output the response
      Returns:
        The file containing the response
      Throws:
        `RequestBuilder.RequestBuilderException` - If sending the request failed
        `java.lang.SecurityException` - TODO
        `java.io.IOException` - TODO
      See Also:
        IPFS API Doc

    - #### sendToStream

          public java.io.OutputStream sendToStream​(@NonNull
                                                   java.io.OutputStream outStream,
                                                   int blockSize)
                                            throws RequestBuilder.RequestBuilderException,
                                                   java.lang.SecurityException,
                                                   java.io.IOException

      Sends the request to the underlying go-ipfs node and writes to the output stream.
      Parameters:
        `outStream` - The stream to which to output the response
        `blockSize` - The block size for the read buffer
      Returns:
        The same outStream
      Throws:
        `RequestBuilder.RequestBuilderException` - If sending the request failed
        `java.lang.SecurityException` - TODO
        `java.io.IOException` - TODO
      See Also:
        IPFS API Doc

    - #### sendToStream

          public java.io.OutputStream sendToStream​(@NonNull
                                                   java.io.OutputStream outStream)
                                            throws RequestBuilder.RequestBuilderException,
                                                   java.lang.SecurityException,
                                                   java.io.IOException

      Throws:
        `RequestBuilder.RequestBuilderException`
        `java.lang.SecurityException`
        `java.io.IOException`

    - #### withArgument

          public RequestBuilder withArgument​(@NonNull
                                             java.lang.String argument)

      Adds an argument to the request.
      Parameters:
        `argument` - The argument to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withOption

          public RequestBuilder withOption​(@NonNull
                                           java.lang.String option,
                                           boolean value)

      Adds a boolean option to the request.
      Parameters:
        `option` - The name of the option to add
        `value` - The boolean value of the option to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withOption

          public RequestBuilder withOption​(@NonNull
                                           java.lang.String option,
                                           @NonNull
                                           java.lang.String value)

      Adds a string option to the request.
      Parameters:
        `option` - The name of the option to add
        `value` - The string value of the option to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withOption

          public RequestBuilder withOption​(@NonNull
                                           java.lang.String option,
                                           @NonNull
                                           byte[] value)

      Adds a byte array option to the request.
      Parameters:
        `option` - The name of the option to add
        `value` - The byte array value of the option to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withBody

          public RequestBuilder withBody​(@NonNull
                                         java.io.InputStream body)

      Adds an InputStream body to the request.
      Parameters:
        `body` - The InputStream from which to read the body
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withBody

          public RequestBuilder withBody​(@NonNull
                                         java.lang.String body)

      Adds a string body to the request.
      Parameters:
        `body` - The string value of the body to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withBody

          public RequestBuilder withBody​(@NonNull
                                         byte[] body)

      Adds a byte array body to the request.
      Parameters:
        `body` - The byte array value of the body to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc

    - #### withBody

          public RequestBuilder withBody​(@NonNull
                                         java.io.File body)
                                  throws java.io.FileNotFoundException

      Adds a file as a body to the request.
      Parameters:
        `body` - The file to add as a body
      Returns:
        This instance of RequestBuilder
      Throws:
        `java.io.FileNotFoundException` - If the file is inaccessible
      See Also:
        IPFS API Doc

    - #### withHeader

          public RequestBuilder withHeader​(@NonNull
                                           java.lang.String key,
                                           @NonNull
                                           java.lang.String value)

      Adds a header to the request.
      Parameters:
        `key` - The key of the header to add
        `value` - The value of the header to add
      Returns:
        This instance of RequestBuilder
      See Also:
        IPFS API Doc