|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.resource.Variant
org.restlet.resource.Representation
org.restlet.resource.FileRepresentation
public class FileRepresentation
Representation based on a file.
| Field Summary |
|---|
| Fields inherited from class org.restlet.resource.Variant |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
FileRepresentation(File file,
MediaType mediaType,
int timeToLive)
Constructor. |
|
FileRepresentation(String path,
MediaType mediaType,
int timeToLive)
Constructor. |
|
| Method Summary | |
|---|---|
FileChannel |
getChannel()
Returns a readable byte channel. |
long |
getSize()
Returns the size in bytes if known, UNKNOWN_SIZE (-1) otherwise. |
FileInputStream |
getStream()
Returns a stream with the representation's content. |
String |
getText()
Converts the representation to a string value. |
void |
write(OutputStream outputStream)
Writes the representation to a byte stream. |
void |
write(WritableByteChannel writableChannel)
Writes the representation to a byte channel. |
| Methods inherited from class org.restlet.resource.Representation |
|---|
isAvailable, isTransient, setAvailable, setTransient |
| Methods inherited from class org.restlet.resource.Variant |
|---|
getCharacterSet, getEncodings, getExpirationDate, getIdentifier, getLanguages, getMediaType, getModificationDate, getTag, setCharacterSet, setExpirationDate, setIdentifier, setIdentifier, setMediaType, setModificationDate, setSize, setTag |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileRepresentation(File file,
MediaType mediaType,
int timeToLive)
file - The represented file.mediaType - The representation's media type.timeToLive - The time to live before it expires (in seconds).
public FileRepresentation(String path,
MediaType mediaType,
int timeToLive)
path - The path name or file URI of the represented file.mediaType - The representation's media type.timeToLive - The time to live before it expires (in seconds).File.File(String)| Method Detail |
|---|
public FileChannel getChannel()
throws IOException
getChannel in class RepresentationIOExceptionpublic long getSize()
getSize in class Variant
public FileInputStream getStream()
throws IOException
getStream in class RepresentationIOException
public String getText()
throws IOException
getText in class RepresentationIOException
public void write(OutputStream outputStream)
throws IOException
write in class RepresentationoutputStream - The output stream.
IOException
public void write(WritableByteChannel writableChannel)
throws IOException
write in class RepresentationwritableChannel - A writable byte channel.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||