org.apache.nutch.protocol
Class Content

java.lang.Object
  extended byorg.apache.nutch.io.VersionedWritable
      extended byorg.apache.nutch.protocol.Content
All Implemented Interfaces:
Writable

public final class Content
extends VersionedWritable


Field Summary
static String DIR_NAME
           
 
Constructor Summary
Content()
           
Content(String url, String base, byte[] content, String contentType, Properties metadata)
           
 
Method Summary
 boolean equals(Object o)
           
 String get(String name)
          Return the value of a metadata property.
 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.
 Properties getMetadata()
          Other protocol-specific data.
 String getUrl()
          The url fetched.
 byte getVersion()
          Return the version number of the current implementation.
static void main(String[] argv)
           
static Content read(DataInput in)
           
 void readFields(DataInput in)
          Reads the fields of this object from in.
 void setContent(byte[] content)
           
 void setContentType(String contentType)
           
 String toString()
           
 void write(DataOutput out)
          Writes the fields of this object to 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,
               Properties metadata)
Method Detail

getVersion

public byte getVersion()
Description copied from class: VersionedWritable
Return the version number of the current implementation.

Specified by:
getVersion in class VersionedWritable

readFields

public final void readFields(DataInput in)
                      throws IOException
Description copied from interface: Writable
Reads the fields of this object from in. For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Overrides:
readFields in class VersionedWritable
Throws:
IOException

write

public final void write(DataOutput out)
                 throws IOException
Description copied from interface: Writable
Writes the fields of this object to out.

Specified by:
write in interface Writable
Overrides:
write in class VersionedWritable
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 Properties getMetadata()
Other protocol-specific data.


get

public String get(String name)
Return the value of a metadata property.


equals

public boolean equals(Object o)

toString

public String toString()

main

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


Copyright © 2006 The Apache Software Foundation