001/**
002 * Copyright 2010-2016 Boxfuse GmbH
003 * <p/>
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p/>
008 * http://www.apache.org/licenses/LICENSE-2.0
009 * <p/>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.avaje.classpath.scanner;
017
018/**
019 * A loadable resource.
020 */
021public interface Resource {
022
023  /**
024   * Return the location of the resource on the classpath (path and filename).
025   */
026  String getLocation();
027
028  /**
029   * Return the location of this resource on disk.
030   */
031  String getLocationOnDisk();
032
033  /**
034   * Return the content of this resource as a string.
035   *
036   * @param encoding The encoding to use.
037   * @return The string contents of the resource.
038   */
039  String loadAsString(String encoding);
040
041  /**
042   * Return the context of this resource as a byte array.
043   */
044  byte[] loadAsBytes();
045
046  /**
047   * Return the filename of this resource, without the path.
048   */
049  String getFilename();
050}