Class ResourceDescriptor
-
- All Implemented Interfaces:
public final class ResourceDescriptorA Resource Descriptor. This contains all the information known about the resource, to allow the loading function to read the data and apply the correct charset and data conversion required.
The InputStream will already have been opened (and in the case of HTTP(S), the headers will have been read and analysed for details like character set, MIME type etc.), and it should be closed after use.
Peter Wall
-
-
Field Summary
Fields Modifier and Type Field Description private final InputStreaminputStreamprivate final URLurlprivate final StringcharsetNameprivate final Longsizeprivate final Instanttimeprivate final StringmimeTypeprivate final StringeTag
-
Constructor Summary
Constructors Constructor Description ResourceDescriptor(InputStream inputStream, URL url, String charsetName, Long size, Instant time, String mimeType, String eTag)
-
Method Summary
Modifier and Type Method Description final InputStreamgetInputStream()final URLgetUrl()final StringgetCharsetName()final LonggetSize()final InstantgetTime()final StringgetMimeType()final StringgetETag()final ReadergetReader(Charset defaultCharset)Get a Reader to read the resource. -
-
Method Detail
-
getInputStream
final InputStream getInputStream()
-
getCharsetName
final String getCharsetName()
-
getMimeType
final String getMimeType()
-
getReader
final Reader getReader(Charset defaultCharset)
Get a Reader to read the resource. If the resource specifies an explicit charset name, the function will attempt to locate a charset with that name, and if it is successful that charset will be used. If the resource does not specify an explicit charset name and the
defaultCharsetparameter is provided, that will be used. If neither is provided, the DynamicReader will choose the charset based on the content of the data (in most cases this will be the best option).- Parameters:
defaultCharset- the charset to use if the resource does not specify an explicit charset- Returns:
a Reader (but see the comment below)
-
-
-
-