Java Resource Load getResourceString(String filename)

Here you can find the source of getResourceString(String filename)

Description

get Resource String

License

Open Source License

Declaration

public static String getResourceString(String filename) throws FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static String getResourceString(String filename) throws FileNotFoundException {
        String rootPath = "./Oracle/src/test/resources/co/digitaloracle/";
        String string = new Scanner(new File(rootPath + filename)).useDelimiter("\\Z").next();
        return string;
    }//ww w .j  av  a2 s . co  m
}

Related

  1. getResourceStream(String name)
  2. getResourceStream(String pathToResource)
  3. getResourceStream(String resource, Class root)
  4. getResourceStreamFromClasspath(Class clazz, String resourceName)
  5. getResourceStreamInPackage(Class clazz, String name)
  6. getResourceUri(final String packageToScan, final ClassLoader classLoader)
  7. getResourceUrl(final Class aClass, final String aPath)
  8. getResourceUrl(final String resourcePath)
  9. getResourceUrl(String path, String extension, ClassLoader loader)