class FileSchemeStrategy implements SchemeStrategy {

    @Override
    public InputStream getInputStream(final String sessionId, final URI uri,
            final RequestMethod method, final long timeout,
            final Collection<KeyValuePair> parameters)
            throws BadFetchError {

        try {
            // Remove the fragment.
            // A file based URI may only have a scheme and a path.
            final String scheme = uri.getScheme();
            final String path = uri.getPath();
            final URI fragmentLessUri = new URI(scheme, null, path, null);
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("reading '" + fragmentLessUri + "'...");
            }
            final File file = new File(fragmentLessUri);
            return new FileInputStream(file);
        } catch (java.io.FileNotFoundException e) {
            throw new BadFetchError(e.getMessage(), e);
        } catch (java.lang.IllegalArgumentException e) {
            throw new BadFetchError(e.getMessage(), e);
        } catch (URISyntaxException e) {
            throw new BadFetchError(e.getMessage(), e);
        }
    }

    public  FileSchemeStrategy();

}