public class ProcessPipeUtils extends Object
| Constructor and Description |
|---|
ProcessPipeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static FileCreation |
createFileCreation(Process process,
Path path) |
static Function<InputStream,InputStream> |
createPipedTransformer(BiConsumer<InputStream,OutputStream> action)
TODO Move this method elsewhere as it does not make use of a process
Transformation using a piped input/outputstream
createPipedTransform((in, out) -> { for(item : () -> readItems(in)) { write(item); } )
|
static void |
main(String[] args)
TODO Convert to test cases
|
static BiFunction<Path,Path,FileCreation> |
mapPathToPath(BiFunction<Path,Path,String[]> cmdBuilder) |
static PathToStream |
mapPathToStream(Function<Path,String[]> cmdBuilder) |
static BiFunction<InputStreamOrPath,Path,FileCreation> |
mapStreamToPath(Function<Path,String[]> cmdBuilder) |
static StreamToStream |
mapStreamToStream(String[] cmd) |
static Process |
startProcess(ProcessBuilder processBuilder) |
static Thread |
startThreadedCopy(InputStream from,
OutputStream to,
Consumer<Exception> failureCallback)
Create a new thread to copy from source to target
TODO Closing the target silently terminate the thread and associated
resources (such as a system process)
Closing the input stream should not happen though as it is
considered to be owned by the copy process
|
public static void main(String[] args) throws Exception
args - Exceptionpublic static Function<InputStream,InputStream> createPipedTransformer(BiConsumer<InputStream,OutputStream> action)
action - public static Thread startThreadedCopy(InputStream from, OutputStream to, Consumer<Exception> failureCallback)
from - to - public static Process startProcess(ProcessBuilder processBuilder)
public static PathToStream mapPathToStream(Function<Path,String[]> cmdBuilder)
public static FileCreation createFileCreation(Process process, Path path)
public static BiFunction<InputStreamOrPath,Path,FileCreation> mapStreamToPath(Function<Path,String[]> cmdBuilder)
public static BiFunction<Path,Path,FileCreation> mapPathToPath(BiFunction<Path,Path,String[]> cmdBuilder)
public static StreamToStream mapStreamToStream(String[] cmd)
Copyright © 2020. All rights reserved.