Package org.apache.camel.tooling.util
Class PackageHelper
- java.lang.Object
-
- org.apache.camel.tooling.util.PackageHelper
-
public final class PackageHelper extends Object
Utility class to find, read json files.
-
-
Field Summary
Fields Modifier and Type Field Description static StringJSON_SUFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringafter(String text, String after)static StringasName(Path file)Returns the name of the component, data format or language from the given json filestatic FilefindCamelCoreDirectory(File dir)static FilefindCamelCoreModelDirectory(File dir)static FilefindCamelDirectory(File dir, String path)static Set<File>findJsonFiles(File rootDir, Set<File> files)static Stream<Path>findJsonFiles(Path rootDir)static StringgetSchemaKind(String json)Extract the model kind from a given json schemastatic StringloadText(File file)static StringloadText(InputStream in)Loads the entire stream into memory as a String and returns it.static StringloadText(Path file)static Map<String,String>parseAsMap(String data)Parses the text as a map (eg key=value)static Stream<Path>walk(Path rootDir)static voidwriteText(File file, String text)
-
-
-
Field Detail
-
JSON_SUFIX
public static final String JSON_SUFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadText
public static String loadText(InputStream in) throws IOException
Loads the entire stream into memory as a String and returns it. Warning, don't use for crazy big streams :)- Throws:
IOException
-
loadText
public static String loadText(File file) throws IOException
- Throws:
IOException
-
loadText
public static String loadText(Path file) throws IOException
- Throws:
IOException
-
writeText
public static void writeText(File file, String text) throws IOException
- Throws:
IOException
-
parseAsMap
public static Map<String,String> parseAsMap(String data)
Parses the text as a map (eg key=value)- Parameters:
data- the data- Returns:
- the map
-
asName
public static String asName(Path file)
Returns the name of the component, data format or language from the given json file
-
-