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 io.avaje.classpath.scanner;
017
018import java.io.InputStream;
019import java.nio.charset.Charset;
020import java.util.List;
021
022/**
023 * A loadable resource.
024 */
025public interface Resource {
026
027  /**
028   * Return the location of the resource on the classpath (path and filename).
029   */
030  String location();
031
032  /**
033   * Return the name of this resource, without the path.
034   */
035  String name();
036
037  /**
038   * Return the content as InputStream.
039   */
040  InputStream inputStream();
041
042  /**
043   * Return the content as lines.
044   */
045  List<String> loadAsLines(Charset charset);
046
047  /**
048   * Return the content of this resource as a string.
049   */
050  String loadAsString(Charset charset);
051
052}