Package org.apache.nutch.protocol
Class Content
java.lang.Object
org.apache.nutch.protocol.Content
- All Implemented Interfaces:
Writable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe base url for relative links contained in the content.byte[]The binary content retrieved.The media type of the retrieved content.Other protocol-specific data.getUrl()The url fetched.static voidstatic Contentfinal voidreadFields(DataInput in) voidsetContent(byte[] content) voidsetContentType(String contentType) voidsetMetadata(Metadata metadata) Other protocol-specific data.toString()final voidwrite(DataOutput out)
-
Field Details
-
DIR_NAME
- See Also:
-
-
Constructor Details
-
Content
public Content() -
Content
public Content(String url, String base, byte[] content, String contentType, Metadata metadata, Configuration conf) -
Content
-
-
Method Details
-
readFields
- Specified by:
readFieldsin interfaceWritable- Throws:
IOException
-
write
- Specified by:
writein interfaceWritable- Throws:
IOException
-
read
- Throws:
IOException
-
getUrl
The url fetched.- Returns:
- the fetched url
-
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
The media type of the retrieved content.- Returns:
- content type
- See Also:
-
setContentType
-
getMetadata
Other protocol-specific data.- Returns:
- additional
Metadata
-
setMetadata
Other protocol-specific data.- Parameters:
metadata- a populatedMetadataobject to set
-
equals
-
toString
-
toString
-
toString
-
main
- Throws:
Exception
-