public class ContentReference extends Object
This class may be instantiated or subclassed by clients.
Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
JarContentReference
,
JarEntryContentReference
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EXECUTABLE_PERMISSION
Default executable permission when installing a content reference
Will add executable bit if necessary
|
static long |
UNKNOWN_SIZE
Unknown size indication
|
Constructor and Description |
---|
ContentReference(String id,
File file)
Create content reference from file.
|
ContentReference(String id,
URL url)
Create content reference from URL.
|
Modifier and Type | Method and Description |
---|---|
File |
asFile()
Returns the content reference as a file.
|
URL |
asURL()
Returns the content reference as a URL.
|
ContentReference |
createContentReference(String id,
File file)
A factory method to create a content reference of
the same type.
|
String |
getIdentifier()
Retrieves the "symbolic" path identifier for the reference.
|
long |
getInputSize()
Returns the size of the referenced input, if it can be determined.
|
InputStream |
getInputStream()
Creates an input stream for the reference.
|
long |
getLastModified()
Returns the timestamp when the content was last modified
|
int |
getPermission()
Returns the permission for this file.
|
boolean |
isLocalReference()
Indicates whether the reference is a local file reference.
|
void |
setLastModified(long timestamp)
Sets the timestamp the content was last modified.
|
void |
setPermission(int permission)
Sets the permission of this content reference.
|
protected void |
setTempLocal(boolean tempLocal)
Sets if a content reference is considered local
|
String |
toString()
Return string representation of this reference.
|
public static final long UNKNOWN_SIZE
public static final int DEFAULT_EXECUTABLE_PERMISSION
public ContentReference(String id, URL url)
id
- "symbolic" path identifierurl
- actual referenced URLpublic ContentReference createContentReference(String id, File file)
id
- "symbolic" path identifierfile
- actual referenced filepublic String getIdentifier()
public InputStream getInputStream() throws IOException
IOException
- unable to create streampublic long getInputSize() throws IOException
IOException
public boolean isLocalReference()
true
if the reference is local,
otherwise false
public File asFile() throws IOException
IOException
- reference cannot be returned as filepublic URL asURL() throws IOException
IOException
- reference cannot be returned as URLpublic String toString()
public int getPermission()
DEFAULT_EXECUTABLE_PERMISSION
public void setPermission(int permission)
permission
- The permission to setprotected void setTempLocal(boolean tempLocal)
tempLocal
- true
if the file is considered localpublic void setLastModified(long timestamp)
timestamp
- public long getLastModified()
Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.