Java ProcessBuilder how to capture a request to read a file from a process and provide as a stream?

I am a little familiar with ProcessBuilder and process threads. Now I am faced with the problem that the process that I am automating is reading some information from the two files that I need to provide. I am currently writing files and providing paths to the program through ProcessBuilder. Since I expect there will be millions of starts in the near future, I would like to speed things up by doing all the work in memory, rather than reading and writing to a file.

Basically, what I need to do is grab a request to open a file from an automated program and provide the expected data from a string stream or something similar. Of course, if I could tell ProcessBuilder in some way, the file paths that I provide will be replaced by threads, which will be even better.

How can i achieve this?

+3
source share
1 answer

There is no interface for a process that allows you to intercept and modify I / O access like this. If you do not have the source code for the program whose execution you are trying to automate, you will most likely have to do this at the OS level.

, ram disk. Linux, . : Linux RAM Disk: .

, Java named pipe .

0

Source: https://habr.com/ru/post/1788778/


All Articles