
package org.apache.commons.vfs2.provider;

import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileSystemException;

/**
 * Provides methods to parse a file name into a {@link org.apache.commons.vfs2.FileName}.
 */
public interface FileNameParser {

    /**
     * Check if a character needs encoding (%nn).
     *
     * @param ch the character
     * @return true if character should be encoded
     */
    boolean encodeCharacter(char ch);

    /**
     * Parses a String into a file name.
     *
     * @param context The component context.
     * @param base The base FileName.
     * @param uri The target file name.
     * @return A FileName that represents the taret file.
     * @throws FileSystemException if an error occurs parsing the URI.
     */
    FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException;
}
