- Prev Class
- Next Class
org.apache.nutch.protocol
Class Content
- java.lang.Object
- org.apache.nutch.protocol.Content
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
public final class Content extends Object implements org.apache.hadoop.io.Writable
Field Summary
Fields Modifier and Type Field and Description static String
DIR_NAME
Constructor Summary
Constructors Constructor and Description Content()
Content(String url,
String base,
byte[] content,
String contentType,
Metadata metadata,
org.apache.hadoop.conf.Configuration conf)
Method Summary
Methods Modifier and Type Method and 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()
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](../../../../constant-values.html#org.apache.nutch.protocol.Content.DIR_NAME)
Constructor Detail
-
Content
public Content()
-
Content
public Content(String url, String base, byte[] content, String contentType, Metadata metadata, org.apache.hadoop.conf.Configuration conf)
Method Detail
-
readFields
public final void readFields(DataInput in) throws IOException
- Specified by:
- <code>readFields</code> in interface <code>org.apache.hadoop.io.Writable</code>
- Throws:
- <code>IOException</code>
-
write
public final void write(DataOutput out) throws IOException
- Specified by:
- <code>write</code> in interface <code>org.apache.hadoop.io.Writable</code>
- Throws:
- <code>IOException</code>
-
read
public static Content read(DataInput in) throws IOException
- Throws:
- <code>IOException</code>
-
getUrl
public String getUrl()
The url fetched.
-
getBaseUrl
public String getBaseUrl()
The base url for relative links contained in the content. Maybe be different from url if the request redirected.
-
getContent
public byte[] getContent()
The binary content retrieved.
-
setContent
public void setContent(byte[] content)
-
getContentType
public String getContentType()
The media type of the retrieved content.
- See Also:
- [ http://www.iana.org/assignments/media-types/](http://www.iana.org/assignments/media-types/)
-
setContentType
public void setContentType(String contentType)
-
getMetadata
public Metadata getMetadata()
Other protocol-specific data.
-
setMetadata
public void setMetadata(Metadata metadata)
Other protocol-specific data.
-
equals
public boolean equals(Object o)
- Overrides:
- <code>equals</code> in class <code>Object</code>
-
toString
public String toString()
- Overrides:
- <code>toString</code> in class <code>Object</code>
-
main
public static void main(String[] argv) throws Exception
- Throws:
- <code>Exception</code>
- Prev Class
- Next Class