Package org.apache.nutch.protocol
Class Content
- java.lang.Object
-
- org.apache.nutch.protocol.Content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetBaseUrl()The base url for relative links contained in the content.byte[]getContent()The binary content retrieved.StringgetContentType()The media type of the retrieved content.MetadatagetMetadata()Other protocol-specific data.StringgetUrl()The url fetched.static voidmain(String[] argv)static Contentread(DataInput in)voidreadFields(DataInput in)voidsetContent(byte[] content)voidsetContentType(String contentType)voidsetMetadata(Metadata metadata)Other protocol-specific data.StringtoString()StringtoString(String charset)StringtoString(Charset charset)voidwrite(DataOutput out)
-
-
-
Field Detail
-
DIR_NAME
public static final String DIR_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
readFields
public final void readFields(DataInput in) throws IOException
- Specified by:
readFieldsin interfaceWritable- Throws:
IOException
-
write
public final void write(DataOutput out) throws IOException
- Specified by:
writein interfaceWritable- 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 populatedMetadataobject to set
-
-