mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02: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:
parent
bb67841884
commit
ddb0f5692e
23 changed files with 514 additions and 39 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue