org.apache.batik.util
Class ParsedURLData

java.lang.Object
  |
  +--org.apache.batik.util.ParsedURLData

public class ParsedURLData
extends java.lang.Object


Field Summary
static byte[] GZIP_MAGIC
          GZIP header magic number bytes, like found in a gzipped files, which are encoded in Intel format (ie.
 java.lang.String host
           
 java.lang.String path
           
 int port
           
 java.lang.String protocol
          Since the Data instance is 'hidden' in the ParsedURL instance we make all our methods public.
 java.lang.String ref
           
 
Constructor Summary
ParsedURLData()
          Void constructor
ParsedURLData(java.net.URL url)
          Build from an existing URL.
 
Method Summary
protected  java.net.URL buildURL()
          Attempts to build a normal java.net.URL instance from this URL.
static java.io.InputStream checkGZIP(java.io.InputStream is)
          This is a utility function others can call that checks if is is a GZIP stream if so it returns a GZIPInputStream that will decode the contents, otherwise it returns (or a buffered version of is) untouched.
 boolean complete()
          Returns true if the URL looks well formed and complete.
 boolean equals(java.lang.Object obj)
          Implement Object.equals for ParsedURLData.
 java.lang.String getPortStr()
          Returns the URL up to and include the port number on the host.
 int hashCode()
          Implement Object.hashCode.
 java.io.InputStream openStream()
          Open the stream and check for common compression types.
 java.io.InputStream openStreamRaw()
          Open the stream and returns it.
 java.lang.String toString()
          Return a string representation of the data.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

GZIP_MAGIC

public static final byte[] GZIP_MAGIC
GZIP header magic number bytes, like found in a gzipped files, which are encoded in Intel format (ie. little indian).

protocol

public java.lang.String protocol
Since the Data instance is 'hidden' in the ParsedURL instance we make all our methods public. This makes it easy for the various Protocol Handlers to update an instance as parsing proceeds.

host

public java.lang.String host

port

public int port

path

public java.lang.String path

ref

public java.lang.String ref
Constructor Detail

ParsedURLData

public ParsedURLData()
Void constructor

ParsedURLData

public ParsedURLData(java.net.URL url)
Build from an existing URL.
Method Detail

checkGZIP

public static java.io.InputStream checkGZIP(java.io.InputStream is)
                                     throws java.io.IOException
This is a utility function others can call that checks if is is a GZIP stream if so it returns a GZIPInputStream that will decode the contents, otherwise it returns (or a buffered version of is) untouched.
Parameters:
is - Stream that may potentially be a GZIP stream.

buildURL

protected java.net.URL buildURL()
                         throws java.net.MalformedURLException
Attempts to build a normal java.net.URL instance from this URL.

hashCode

public int hashCode()
Implement Object.hashCode.
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Implement Object.equals for ParsedURLData.
Overrides:
equals in class java.lang.Object

complete

public boolean complete()
Returns true if the URL looks well formed and complete. This does not garuntee that the stream can be opened but is a good indication that things aren't totally messed up.

openStream

public java.io.InputStream openStream()
                               throws java.io.IOException
Open the stream and check for common compression types. If the stream is found to be compressed with a standard compression type it is automatically decompressed.

openStreamRaw

public java.io.InputStream openStreamRaw()
                                  throws java.io.IOException
Open the stream and returns it. No checks are made to see if the stream is compressed or encoded in any way.

getPortStr

public java.lang.String getPortStr()
Returns the URL up to and include the port number on the host. Does not include the path or fragment pieces.

toString

public java.lang.String toString()
Return a string representation of the data.
Overrides:
toString in class java.lang.Object


Copyright © 2001 Apache Software Foundation. All Rights Reserved.