org.jppf.server.protocol
Class URLLocation

java.lang.Object
  extended by org.jppf.server.protocol.AbstractLocation<URL>
      extended by org.jppf.server.protocol.URLLocation
All Implemented Interfaces:
Serializable, Location<URL>

public class URLLocation
extends AbstractLocation<URL>

Wrapper for manipulating data from a URL.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jppf.server.protocol.AbstractLocation
eventsEnabled, listeners, path
 
Constructor Summary
URLLocation(String url)
          Initialize this location with the specified file path.
URLLocation(URL url)
          Initialize this location with the specified file path.
 
Method Summary
 InputStream getInputStream()
          Obtain an input stream to read from this location.
 OutputStream getOutputStream()
          Obtain an output stream to write to this location.
 long size()
          This method always returns -1, as there is no reliable way to know the actual size of available data.
 
Methods inherited from class org.jppf.server.protocol.AbstractLocation
addLocationEventListener, copyTo, fireLocationEvent, getPath, removeLocationEventListener, toByteArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLLocation

public URLLocation(URL url)
Initialize this location with the specified file path.

Parameters:
url - a URL.

URLLocation

public URLLocation(String url)
            throws MalformedURLException
Initialize this location with the specified file path.

Parameters:
url - a URL in string format.
Throws:
MalformedURLException - if the url is malformed.
Method Detail

getInputStream

public InputStream getInputStream()
                           throws Exception
Obtain an input stream to read from this location.

Returns:
an InputStream instance.
Throws:
Exception - if an I/O error occurs.
See Also:
Location.getInputStream()

getOutputStream

public OutputStream getOutputStream()
                             throws Exception
Obtain an output stream to write to this location.

Returns:
an OutputStream instance.
Throws:
Exception - if an I/O error occurs.
See Also:
Location.getOutputStream()

size

public long size()
This method always returns -1, as there is no reliable way to know the actual size of available data.

Returns:
-1.
See Also:
Location.size()


Copyright © 2005-2010 JPPF Team.