Package com.dslplatform.compiler.client
Class Utils
- java.lang.Object
-
- com.dslplatform.compiler.client.Utils
-
public abstract class Utils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUtils.CommandResultprivate static classUtils.ConsumeStream
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddeletePath(java.io.File path)private static voiddeletePathAndRetry(java.io.File path, int retry)static voiddownloadFile(java.io.File file, java.net.URL url)private static voiddownloadFileAndRetry(java.io.File file, java.net.URL url, int retry)static Either<java.lang.String>findCommand(Context context, java.lang.String path, java.lang.String name, java.lang.String contains)private static voidfindFiles(Context context, java.io.File path, java.util.List<java.io.File> foundFiles, java.util.List<java.lang.String> extensions)static java.util.List<java.io.File>findFiles(Context context, java.io.File path, java.util.List<java.lang.String> extensions)static java.util.List<java.io.File>findNonEmptyDirs(java.io.File path, java.lang.String extension)private static voidfindNonEmptyDirs(java.io.File path, java.util.List<java.io.File> foundFiles, java.lang.String extension)static booleanisWindows()static java.util.List<java.lang.String>listSources(java.io.File source, Context context, java.lang.String extension)private static voidlogCommand(Context context, java.lang.ProcessBuilder builder)static java.lang.Stringread(java.io.InputStream stream)static Either<java.lang.String>readFile(java.io.File file)static Either<org.w3c.dom.Document>readXml(java.io.InputStream stream)static Either<Utils.CommandResult>runCommand(Context context, java.lang.String command, java.io.File path, java.util.List<java.lang.String> arguments)static Either<Utils.CommandResult>runCommand(Context context, java.lang.String command, java.io.File path, java.util.List<java.lang.String> arguments, java.nio.charset.Charset charset)static voidsaveFile(Context context, java.io.File file, java.lang.String content)static booleantestCommand(Context context, java.lang.String command, java.lang.String contains)static booleantestCommand(Context context, java.lang.String command, java.lang.String contains, java.util.List<java.lang.String> arguments)static longunpackZip(Context context, java.io.File path, java.net.URL remoteUrl)private static longunpackZip(Context context, java.io.File path, java.net.URL remoteUrl, java.util.ArrayList<java.io.File> unpackedFiles, int retry)
-
-
-
Method Detail
-
read
public static java.lang.String read(java.io.InputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
readFile
public static Either<java.lang.String> readFile(java.io.File file)
-
saveFile
public static void saveFile(Context context, java.io.File file, java.lang.String content) throws java.io.IOException
- Throws:
java.io.IOException
-
findFiles
public static java.util.List<java.io.File> findFiles(Context context, java.io.File path, java.util.List<java.lang.String> extensions)
-
findFiles
private static void findFiles(Context context, java.io.File path, java.util.List<java.io.File> foundFiles, java.util.List<java.lang.String> extensions)
-
unpackZip
public static long unpackZip(Context context, java.io.File path, java.net.URL remoteUrl) throws java.io.IOException
- Throws:
java.io.IOException
-
unpackZip
private static long unpackZip(Context context, java.io.File path, java.net.URL remoteUrl, java.util.ArrayList<java.io.File> unpackedFiles, int retry) throws java.io.IOException
- Throws:
java.io.IOException
-
downloadFile
public static void downloadFile(java.io.File file, java.net.URL url) throws java.io.IOException- Throws:
java.io.IOException
-
downloadFileAndRetry
private static void downloadFileAndRetry(java.io.File file, java.net.URL url, int retry) throws java.io.IOException- Throws:
java.io.IOException
-
readXml
public static Either<org.w3c.dom.Document> readXml(java.io.InputStream stream)
-
isWindows
public static boolean isWindows()
-
logCommand
private static void logCommand(Context context, java.lang.ProcessBuilder builder)
-
findCommand
public static Either<java.lang.String> findCommand(Context context, java.lang.String path, java.lang.String name, java.lang.String contains)
-
testCommand
public static boolean testCommand(Context context, java.lang.String command, java.lang.String contains)
-
testCommand
public static boolean testCommand(Context context, java.lang.String command, java.lang.String contains, java.util.List<java.lang.String> arguments)
-
runCommand
public static Either<Utils.CommandResult> runCommand(Context context, java.lang.String command, java.io.File path, java.util.List<java.lang.String> arguments)
-
runCommand
public static Either<Utils.CommandResult> runCommand(Context context, java.lang.String command, java.io.File path, java.util.List<java.lang.String> arguments, java.nio.charset.Charset charset)
-
deletePath
public static void deletePath(java.io.File path) throws java.io.IOException- Throws:
java.io.IOException
-
deletePathAndRetry
private static void deletePathAndRetry(java.io.File path, int retry) throws java.io.IOException- Throws:
java.io.IOException
-
findNonEmptyDirs
public static java.util.List<java.io.File> findNonEmptyDirs(java.io.File path, java.lang.String extension)
-
findNonEmptyDirs
private static void findNonEmptyDirs(java.io.File path, java.util.List<java.io.File> foundFiles, java.lang.String extension)
-
listSources
public static java.util.List<java.lang.String> listSources(java.io.File source, Context context, java.lang.String extension)
-
-