| |
|
| java.lang.Object org.restlet.resource.Variant org.restlet.resource.Representation org.restlet.resource.FileRepresentation
FileRepresentation | public class FileRepresentation extends Representation (Code) | | Representation based on a file.
author: Jerome Louvel (contact@noelios.com) |
FileRepresentation | public FileRepresentation(File file, MediaType mediaType, int timeToLive)(Code) | | Constructor.
Parameters: file - The represented file. Parameters: mediaType - The representation's media type. Parameters: timeToLive - The time to live before it expires (in seconds). |
FileRepresentation | public FileRepresentation(String path, MediaType mediaType, int timeToLive)(Code) | | Constructor.
Parameters: path - The path name or file URI of the represented file. Parameters: mediaType - The representation's media type. Parameters: timeToLive - The time to live before it expires (in seconds). See Also: java.io.File.File(String) |
getChannel | public FileChannel getChannel() throws IOException(Code) | | Returns a readable byte channel. If it is supported by a file a read-only
instance of FileChannel is returned.
A readable byte channel. |
getSize | public long getSize()(Code) | | Returns the size in bytes if known, UNKNOWN_SIZE (-1) otherwise.
The size in bytes if known, UNKNOWN_SIZE (-1) otherwise. |
getStream | public FileInputStream getStream() throws IOException(Code) | | Returns a stream with the representation's content.
A stream with the representation's content. |
getText | public String getText() throws IOException(Code) | | Converts the representation to a string value. Be careful when using this
method as the conversion of large content to a string fully stored in
memory can result in OutOfMemoryErrors being thrown.
The representation as a string value. |
write | public void write(OutputStream outputStream) throws IOException(Code) | | Writes the representation to a byte stream.
Parameters: outputStream - The output stream. |
write | public void write(WritableByteChannel writableChannel) throws IOException(Code) | | Writes the representation to a byte channel. Optimizes using the file
channel transferTo method.
Parameters: writableChannel - A writable byte channel. |
Fields inherited from org.restlet.resource.Variant | final public static long UNKNOWN_SIZE(Code)(Java Doc)
|
|
|
|