Package de.intarsys.tools.locator
Interface ILocator
-
- All Superinterfaces:
ISynchronizable
- All Known Implementing Classes:
ByteArrayLocator,ClassLoaderResourceLocator,ClassResourceLocator,CommonLocator,DelegatingLocator,FileLocator,LocatorByReference,LocatorViewport,NullLocator,ReadOnlyLocator,StreamLocator,StringLocator,TransientLocator
public interface ILocator extends ISynchronizable
The locator specifies the physical location of a resource.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddelete()Delete the artifact referenced by this.booleanexists()Answertrueif the location designated by this exists.ILocatorgetChild(java.lang.String name)The locator for the resourcenamewithin the context of this.java.lang.StringgetFullName()The full physical name of this.java.io.InputStreamgetInputStream()Return anInputStreamon the data represented by the receiver.longgetLength()Returns the length of this data container or -1 if unknownjava.lang.StringgetLocalName()The local name of the receiver within its parent.java.io.OutputStreamgetOutputStream()Return anOutputStreamon the location represented by the receiver.ILocatorgetParent()TheILocatorthat is one hierarchy level up or null.IRandomAccessgetRandomAccess()TheIRandomAccessfor this.java.io.ReadergetReader()AReaderon the data represented by the receiver.java.io.ReadergetReader(java.lang.String encoding)AReaderon the data represented by the receiver for the given encoding.java.lang.StringgetType()The type of the resource.java.lang.StringgetTypedName()The qualified local name of the receiver within its parent that includes the type specification for the destination if appropriate.java.io.WritergetWriter()AWriteron the location represented by the receiver.java.io.WritergetWriter(java.lang.String encoding)AWriteron the location represented by the receiver for the given encoding.booleanisDirectory()Answertrueif the location designated by this is a directory.booleanisReadOnly()trueif the specified resource is read only.ILocator[]listLocators(ILocatorNameFilter filter)Return an array ofILocatorthat are children of the receiver that conform tofilter.voidrename(java.lang.String newName)Rename the complete physical name tonewName.voidsetReadOnly()Make the receiver read only.java.net.URLtoURL()The location designated by this as anURL.-
Methods inherited from interface de.intarsys.tools.component.ISynchronizable
isOutOfSynch, synch
-
-
-
-
Method Detail
-
delete
void delete() throws java.io.IOExceptionDelete the artifact referenced by this.- Throws:
java.io.IOException
-
exists
boolean exists()
Answertrueif the location designated by this exists.- Returns:
- Answer
trueif the location designated by this exists.
-
getChild
ILocator getChild(java.lang.String name)
The locator for the resourcenamewithin the context of this. This may for example be anILocatorto a file within a directory.- Parameters:
name- The name of the resource to be located.- Returns:
- The
ILocatorfor the resource with the name "name" within the context of this.
-
getFullName
java.lang.String getFullName()
The full physical name of this.This method returns a representation that is proprietary to the underlying physical representation, for example a file name, a SQL statement or so on.
- Returns:
- The full physical name of the receiver.
-
getInputStream
java.io.InputStream getInputStream() throws java.io.IOExceptionReturn anInputStreamon the data represented by the receiver.- Returns:
- An
InputStreamon the data represented by the receiver. - Throws:
java.io.IOException
-
getLength
long getLength() throws java.io.IOExceptionReturns the length of this data container or -1 if unknown- Returns:
- the length of this data container, measured in bytes.
- Throws:
java.io.IOException- if an I/O error occurs.
-
getLocalName
java.lang.String getLocalName()
The local name of the receiver within its parent.- Returns:
- The local name of the receiver within its parent.
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOExceptionReturn anOutputStreamon the location represented by the receiver.- Returns:
- An
OutputStreamon the location represented by the receiver. - Throws:
java.io.IOException
-
getParent
ILocator getParent()
TheILocatorthat is one hierarchy level up or null. This may be for example the directory where the currently designated resource is found.- Returns:
- The
ILocatorthat is one hierarchy level up or null.
-
getRandomAccess
IRandomAccess getRandomAccess() throws java.io.IOException
TheIRandomAccessfor this.- Returns:
- The
IRandomAccessfor this. - Throws:
java.io.IOException
-
getReader
java.io.Reader getReader() throws java.io.IOExceptionAReaderon the data represented by the receiver.- Returns:
- A
Readeron the data represented by the receiver. - Throws:
java.io.IOException
-
getReader
java.io.Reader getReader(java.lang.String encoding) throws java.io.IOExceptionAReaderon the data represented by the receiver for the given encoding.- Parameters:
encoding- The encoding.- Returns:
- A
Readeron the data represented by the receiver for the given encoding. - Throws:
java.io.IOException
-
getType
java.lang.String getType()
The type of the resource. This may be for example a mime type or the file extension of the underlying file.- Returns:
- The type of the resource
-
getTypedName
java.lang.String getTypedName()
The qualified local name of the receiver within its parent that includes the type specification for the destination if appropriate. This is for example a filename with its correct suffix. Some locator may return the same name as "getLocalName".- Returns:
- The qualified local name of the receiver within its parent that includes the type specification for the destination if appropriate.
-
getWriter
java.io.Writer getWriter() throws java.io.IOExceptionAWriteron the location represented by the receiver.- Returns:
- A
Writeron the location represented by the receiver. - Throws:
java.io.IOException
-
getWriter
java.io.Writer getWriter(java.lang.String encoding) throws java.io.IOExceptionAWriteron the location represented by the receiver for the given encoding.- Parameters:
encoding- The encoding.- Returns:
- A
Writeron the location represented by the receiver for the given encoding. - Throws:
java.io.IOException
-
isDirectory
boolean isDirectory()
Answertrueif the location designated by this is a directory. A directory location serves as a container for other resources, you can nevergetInputStreamon this.- Returns:
- Answer
trueif the location designated by this is a directory.
-
isReadOnly
boolean isReadOnly()
trueif the specified resource is read only.- Returns:
trueif the specified resource is read only.
-
listLocators
ILocator[] listLocators(ILocatorNameFilter filter) throws java.io.IOException
Return an array ofILocatorthat are children of the receiver that conform tofilter. This method never returns null.- Parameters:
filter- The filter used to examine the child resources.- Returns:
- An array of
ILocatorobjects that conform to the filter argument. - Throws:
java.io.IOException
-
rename
void rename(java.lang.String newName) throws java.io.IOExceptionRename the complete physical name tonewName.- Parameters:
newName- The new name of theILocator. The new name is expected to contain both local and type part of the name.- Throws:
java.io.IOException
-
setReadOnly
void setReadOnly()
Make the receiver read only. This is a one way switch only.
-
toURL
java.net.URL toURL()
The location designated by this as anURL.- Returns:
- The location designated by this as an
URL.
-
-