Enterprise Information Portal APIs

com.ibm.gcs.netutil
Class GCSFileConnection

java.lang.Object
  |
  +--java.net.URLConnection
        |
        +--com.ibm.gcs.netutil.GCSFileConnection

public class GCSFileConnection
extends java.net.URLConnection

The GCSFileConnection is a customization of the URLConnection object and defines a connection object corresponding to the GCS "file" protocol. A GCSFileConnection object is returned by the openConnection method of the GCSFileStreamHandler class for the "file" protocol. NOTE: Right now, GCS will NOT connect to a file on a machine other than the localhost. So file://another_machine/d:/foo/bar will throw an IOException.

See Also:
URLConnection, GCSFileStreamHandler

Constructor Summary
GCSFileConnection(java.net.URL u)
          (constructor)
 
Method Summary
 void connect()
          Opens a connection to the URL if already not connected.
 int getContentLength()
          Get the length of the content (length of the content header field).
 java.lang.String getContentType()
          Returns the value of the content-type header field.
 java.io.InputStream getInputStream()
          get an input stream that reads from this open connection overrides the super class's getInputStream method.
 
Methods inherited from class java.net.URLConnection
getAllowUserInteraction, getContent, getContent, getContentEncoding, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getRequestProperty, getURL, getUseCaches, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GCSFileConnection

public GCSFileConnection(java.net.URL u)
(constructor)
Parameters:
u - URL object for which a connection object is created
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
get an input stream that reads from this open connection overrides the super class's getInputStream method. It basically creates an Input-Output stream pipe. It seralizes the file object associated with this connection into the output stream and returns the corresponding input stream.
Overrides:
getInputStream in class java.net.URLConnection
Returns:
an input stream for reading
Throws:
java.io.IOException - when a File IO exception happens
See Also:
URLConnection.getInputStream()

getContentType

public java.lang.String getContentType()
Returns the value of the content-type header field. It overrides the parent class' getContentType method. This method is called by the getContent() method of the parent class. Based on the return value it calls the ContentHandlerFactory's content handler(In this case GCSContentHandlerFactory's GCSFileContentHandler object). If the file connection is to a directory it returns "file/dir" If it is to a non-directory file it returns "file/" where is the file name's extension field Otherwise, it returns a "" string Question (Neel): Can this method replace the Recognizer?
Overrides:
getContentType in class java.net.URLConnection
Returns:
a string representing the content type
See Also:
URLConnection.getContentType(), URLConnection.getContent(), GCSContentHandlerFactory, GCSFileContentHandler

getContentLength

public int getContentLength()
Get the length of the content (length of the content header field). Overrides the URLConnection's getContentLength method.
Overrides:
getContentLength in class java.net.URLConnection
Returns:
-1
See Also:
URLConnection.getContentLength()

connect

public void connect()
             throws java.io.IOException
Opens a connection to the URL if already not connected. Implements the corresponding abstract method in the parent class. Basically just sets the connected field to true.
Overrides:
connect in class java.net.URLConnection
See Also:
URLConnection.connect(), java.net.URLConnection#connected

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.