Class ResourceDescriptor

  • All Implemented Interfaces:

    
    public final class ResourceDescriptor
    
                        

    A 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.

    Author:

    Peter Wall

    • Method Detail

      • 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 defaultCharset parameter 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)