com.arsdigita.util.url
Class URLData

java.lang.Object
  extended bycom.arsdigita.util.url.URLData

public class URLData
extends Object


Constructor Summary
URLData(String url)
          Create a new URLData object with the given URL
URLData(String url, Map headers, byte[] content)
          Create a new URLData the given URL, headers, and content
 
Method Summary
 byte[] getContent()
          This is a byte array representation of the content returned by the connection.
 String getContentAsString()
          Deprecated. use getContent() and then use the appropriate charset to do the converstion. This also only works when the content is text and there are no guarantees when the returned content is actually binary.
 String getContentType()
          this returns the content type after the headers have been set.
 Exception getException()
          this returns any exception that was raised while downloading or reading the URL.
 Map getHeaders()
          This returns any headers that were returned when the connection was opened to the URL
 String getURL()
          This returns the actual URL that is represented by the data
 void setContent(byte[] content)
           
 void setException(Exception e)
          This is the exception that was raised while trying to connect to the URL or read data from the url
 void setHeaders(Map headers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLData

public URLData(String url)
Create a new URLData object with the given URL


URLData

public URLData(String url,
               Map headers,
               byte[] content)
Create a new URLData the given URL, headers, and content

Method Detail

getURL

public String getURL()
This returns the actual URL that is represented by the data


getHeaders

public Map getHeaders()
This returns any headers that were returned when the connection was opened to the URL


setHeaders

public void setHeaders(Map headers)

getContent

public byte[] getContent()
This is a byte array representation of the content returned by the connection. This returns an empty array of length zero if there is no content.


setContent

public void setContent(byte[] content)

getContentAsString

public String getContentAsString()
Deprecated. use getContent() and then use the appropriate charset to do the converstion. This also only works when the content is text and there are no guarantees when the returned content is actually binary.

This is a convenience method that returns the content as a String in using the best encoding that it is able to guess.


setException

public void setException(Exception e)
This is the exception that was raised while trying to connect to the URL or read data from the url


getException

public Exception getException()
this returns any exception that was raised while downloading or reading the URL. This will return null when no exception was raised.


getContentType

public String getContentType()
this returns the content type after the headers have been set. This is merely a convenience method



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC