org.jppf.server.protocol
Class FileLocation

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

public class FileLocation
extends AbstractLocation<File>

Wrapper fro manipulating a file.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jppf.server.protocol.AbstractLocation
eventsEnabled, listeners, path
 
Constructor Summary
FileLocation(File file)
          Initialize this location with the specified file path.
FileLocation(String file)
          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()
          Get the size of the file this location points to.
 
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

FileLocation

public FileLocation(File file)
Initialize this location with the specified file path.

Parameters:
file - an abstract file path.

FileLocation

public FileLocation(String file)
Initialize this location with the specified file path.

Parameters:
file - an abstract file path.
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()
Get the size of the file this location points to.

Returns:
the size as a long value, or -1 if the file does not exist.
See Also:
Location.size()


Copyright © 2005-2010 JPPF Team.