mirror of
https://github.com/google/nomulus
synced 2026-01-10 07:57:58 +00:00
Add golden files for request component routing maps
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157026188
This commit is contained in:
@@ -26,17 +26,21 @@ import java.net.URL;
|
||||
/** Utility methods related to reading java resources. */
|
||||
public final class ResourceUtils {
|
||||
|
||||
/** Loads a file as a string, assuming UTF-8 encoding. */
|
||||
/** Loads a resource from a file as a string, assuming UTF-8 encoding. */
|
||||
public static String readResourceUtf8(String filename) {
|
||||
return resourceToString(getResource(filename));
|
||||
return readResourceUtf8(getResource(filename));
|
||||
}
|
||||
|
||||
/** Loads a file (specified relative to the contextClass) as a string, assuming UTF-8 encoding. */
|
||||
/**
|
||||
* Loads a resource from a file (specified relative to the contextClass) as a string, assuming
|
||||
* UTF-8 encoding.
|
||||
*/
|
||||
public static String readResourceUtf8(Class<?> contextClass, String filename) {
|
||||
return resourceToString(getResource(contextClass, filename));
|
||||
return readResourceUtf8(getResource(contextClass, filename));
|
||||
}
|
||||
|
||||
private static String resourceToString(URL url) {
|
||||
/** Loads a resource from a URL as a string, assuming UTF-8 encoding. */
|
||||
public static String readResourceUtf8(URL url) {
|
||||
try {
|
||||
return Resources.toString(url, UTF_8);
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user