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 Details

  • Method Details

    • 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
    • after

      public static String after(String text, String after)
    • 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
    • findJsonFiles

      public static Set<File> findJsonFiles(File rootDir, Set<File> files)
    • findJsonFiles

      public static Stream<Path> findJsonFiles(Path rootDir)
    • walk

      public static Stream<Path> walk(Path rootDir)
    • asName

      public static String asName(Path file)
      Returns the name of the component, data format or language from the given json file
    • findCamelCoreDirectory

      public static File findCamelCoreDirectory(File dir)
    • findCamelCoreModelDirectory

      public static File findCamelCoreModelDirectory(File dir)
    • findCamelDirectory

      public static File findCamelDirectory(File dir, String path)
    • getSchemaKind

      public static String getSchemaKind(String json)
      Extract the model kind from a given json schema