org.apache.nutch.protocol
Class Content

java.lang.Object
  extended by org.apache.hadoop.io.CompressedWritable
      extended by org.apache.nutch.protocol.Content
All Implemented Interfaces:
Writable

public final class Content
extends CompressedWritable


Field Summary
static String DIR_NAME
           
 
Constructor Summary
Content()
           
Content(String url, String base, byte[] content, String contentType, Metadata metadata, Configuration conf)
           
 
Method Summary
 void ensureInflated()
          Must be called by all methods which access fields to ensure that the data has been uncompressed.
 boolean equals(Object o)
           
 void forceInflate()
          By calling this method caller forces the next access to any property (via getters and setters) to check if decompressing of data is really required.
 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.
 int hashCode()
           
static Content read(DataInput in)
           
protected  void readFieldsCompressed(DataInput in)
          Subclasses implement this instead of CompressedWritable.readFields(DataInput).
 void setContent(byte[] content)
           
 void setContentType(String contentType)
           
 void setMetadata(Metadata metadata)
          Other protocol-specific data.
 String toString()
           
protected  void writeCompressed(DataOutput out)
          Subclasses implement this instead of CompressedWritable.write(DataOutput).
 
Methods inherited from class org.apache.hadoop.io.CompressedWritable
readFields, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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)
Method Detail

ensureInflated

public void ensureInflated()
Description copied from class: CompressedWritable
Must be called by all methods which access fields to ensure that the data has been uncompressed.

Overrides:
ensureInflated in class CompressedWritable

readFieldsCompressed

protected final void readFieldsCompressed(DataInput in)
                                   throws IOException
Description copied from class: CompressedWritable
Subclasses implement this instead of CompressedWritable.readFields(DataInput).

Specified by:
readFieldsCompressed in class CompressedWritable
Throws:
IOException

writeCompressed

protected final void writeCompressed(DataOutput out)
                              throws IOException
Description copied from class: CompressedWritable
Subclasses implement this instead of CompressedWritable.write(DataOutput).

Specified by:
writeCompressed in class CompressedWritable
Throws:
IOException

read

public static Content read(DataInput in)
                    throws IOException
Throws:
IOException

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/

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:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

forceInflate

public void forceInflate()
By calling this method caller forces the next access to any property (via getters and setters) to check if decompressing of data is really required.



Copyright © 2007, 2012, Oracle and/or its affiliates. All rights reserved.