Package org.apache.nutch.protocol

## Class Content

- java.lang.Object
- - org.apache.nutch.protocol.Content

- All Implemented Interfaces:
    `Writable`

      public final class Content
      extends Object
      implements Writable

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `DIR_NAME` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Content()` |
    `Content​(String url, String base, byte[] content, String contentType, Metadata metadata, Configuration conf)` |
    `Content​(String url, String base, byte[] content, String contentType, Metadata metadata, MimeUtil mimeTypes)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object o)` |
    `String` | `getBaseUrl()` | The base url for relative links contained in the content.
    `byte[]` | `getContent()` | The binary content retrieved.
    `String` | `getContentType()` | The media type of the retrieved content.
    `Metadata` | `getMetadata()` | Other protocol-specific data.
    `String` | `getUrl()` | The url fetched.
    `static void` | `main​(String[] argv)` |
    `static Content` | `read​(DataInput in)` |
    `void` | `readFields​(DataInput in)` |
    `void` | `setContent​(byte[] content)` |
    `void` | `setContentType​(String contentType)` |
    `void` | `setMetadata​(Metadata metadata)` | Other protocol-specific data.
    `String` | `toString()` |
    `String` | `toString​(String charset)` |
    `String` | `toString​(Charset charset)` |
    `void` | `write​(DataOutput out)` |

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

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

- - ### Field Detail

    - #### DIR_NAME

          public static final String DIR_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Content

          public Content()

    - #### Content

          public Content​(String url,
                         String base,
                         byte[] content,
                         String contentType,
                         Metadata metadata,
                         Configuration conf)

    - #### Content

          public Content​(String url,
                         String base,
                         byte[] content,
                         String contentType,
                         Metadata metadata,
                         MimeUtil mimeTypes)

  - ### Method Detail

    - #### readFields

          public final void readFields​(DataInput in)
                                throws IOException

      Specified by:
        `readFields` in interface `Writable`
      Throws:
        `IOException`

    - #### write

          public final void write​(DataOutput out)
                           throws IOException

      Specified by:
        `write` in interface `Writable`
      Throws:
        `IOException`

    - #### read

          public static Content read​(DataInput in)
                              throws IOException

      Throws:
        `IOException`

    - #### getUrl

          public String getUrl()

      The url fetched.
      Returns:
        the fetched url

    - #### getBaseUrl

          public String getBaseUrl()

      The base url for relative links contained in the content. Maybe be different from url if the request redirected.
      Returns:
        the base url

    - #### getContent

          public byte[] getContent()

      The binary content retrieved.
      Returns:
        content as a byte[]

    - #### setContent

          public void setContent​(byte[] content)

    - #### getContentType

          public String getContentType()

      The media type of the retrieved content.
      Returns:
        content type
      See Also:
        http://www.iana.org/assignments/media-types/

    - #### setContentType

          public void setContentType​(String contentType)

    - #### getMetadata

          public Metadata getMetadata()

      Other protocol-specific data.
      Returns:
        additional `Metadata`

    - #### setMetadata

          public void setMetadata​(Metadata metadata)

      Other protocol-specific data.
      Parameters:
        `metadata` - a populated `Metadata` object to set

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString​(String charset)

    - #### toString

          public String toString​(Charset charset)

    - #### main

          public static void main​(String[] argv)
                           throws Exception

      Throws:
        `Exception`