loci.formats
Class Location

java.lang.Object
  extended by loci.formats.Location

public class Location
extends Object

Pseudo-extension of java.io.File that supports reading over HTTP. It is strongly recommended that you use this instead of java.io.File.

Source code:
Trac, SVN


Constructor Summary
Location(File file)
           
Location(Location parent, String child)
           
Location(String pathname)
           
Location(String parent, String child)
           
 
Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 boolean createNewFile()
           
 boolean delete()
           
 void deleteOnExit()
           
 boolean equals(Object obj)
           
 boolean exists()
           
 Location getAbsoluteFile()
           
 String getAbsolutePath()
           
 Location getCanonicalFile()
           
 String getCanonicalPath()
           
static Hashtable getIdMap()
           
static String getMappedId(String id)
          Gets the actual filename on disk for the given id.
 String getName()
           
 String getParent()
           
 Location getParentFile()
           
 String getPath()
           
 boolean isAbsolute()
           
 boolean isDirectory()
           
 boolean isFile()
           
 boolean isHidden()
           
 long lastModified()
           
 long length()
           
 String[] list()
           
 Location[] listFiles()
           
static void mapId(String id, String filename)
          Maps the given id to the actual filename on disk.
static void setIdMap(Hashtable map)
           
 String toString()
           
 URL toURL()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location(String pathname)

Location

public Location(File file)

Location

public Location(String parent,
                String child)

Location

public Location(Location parent,
                String child)
Method Detail

mapId

public static void mapId(String id,
                         String filename)
Maps the given id to the actual filename on disk. Typically actual filenames are used for ids, making this step unnecessary, but in some cases it is useful; e.g., if the file has been renamed to conform to a standard naming scheme and the original file extension is lost, then using the original filename as the id assists format handlers with type identification and pattern matching, and the id can be mapped to the actual filename for reading the file's contents.

See Also:
getMappedId(String)

getMappedId

public static String getMappedId(String id)
Gets the actual filename on disk for the given id. Typically the id itself is the filename, but in some cases may not be; e.g., if OMEIS has renamed a file from its original name to a standard location such as Files/101, the original filename is useful for checking the file extension and doing pattern matching, but the renamed filename is required to read its contents.

See Also:
mapId(String, String)

getIdMap

public static Hashtable getIdMap()

setIdMap

public static void setIdMap(Hashtable map)

canRead

public boolean canRead()

canWrite

public boolean canWrite()

createNewFile

public boolean createNewFile()
                      throws IOException
Throws:
IOException

delete

public boolean delete()

deleteOnExit

public void deleteOnExit()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

exists

public boolean exists()

getAbsoluteFile

public Location getAbsoluteFile()

getAbsolutePath

public String getAbsolutePath()

getCanonicalFile

public Location getCanonicalFile()
                          throws IOException
Throws:
IOException

getCanonicalPath

public String getCanonicalPath()
                        throws IOException
Throws:
IOException

getName

public String getName()

getParent

public String getParent()

getParentFile

public Location getParentFile()

getPath

public String getPath()

isAbsolute

public boolean isAbsolute()

isDirectory

public boolean isDirectory()

isFile

public boolean isFile()

isHidden

public boolean isHidden()

lastModified

public long lastModified()

length

public long length()

list

public String[] list()

listFiles

public Location[] listFiles()

toURL

public URL toURL()
          throws MalformedURLException
Throws:
MalformedURLException

toString

public String toString()
Overrides:
toString in class Object