Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to send output to stdout instead of a file #5

Open
harriettxing opened this issue Jul 30, 2019 · 3 comments
Open

option to send output to stdout instead of a file #5

harriettxing opened this issue Jul 30, 2019 · 3 comments

Comments

@harriettxing
Copy link

Can the the output be directed to stdout instead written to an output file?

@canabrook
Copy link
Contributor

canabrook commented Jul 31, 2019

Yes, but not with the provided driver program. The Java API accepts a java.io.Writer object to handle the output, which can be directed to stdout. The sample driver program, for which the Java source is provided, creates a FileWriter using a filename from the command line. But you could modify the driver program to write to stdout instead. This sounds like it might be a useful feature in a new version; it would allow the content to be piped between Linux tasks without going into a file. Is that what you had in mind?

@harriettxing
Copy link
Author

Yes. I am using the tool in php.
When it writes to a file, I delete the file after loading the json into a php variable.
$out = shell_exec('java -jar edireader-json-basic-5.5.14.jar '.$filename.' '.$outfilename);
$string = file_get_contents($outfilename);
$json_a = json_decode($string, true);
exec("rm ".$outfilename);

If the output can be directed to stdout, I could avoid using the file.
$out = shell_exec('java -jar edireader-json-basic-5.5.14.jar '.$filename.' '.$outfilename);
$json_a = json_decode($out, true);

@canabrook
Copy link
Contributor

I am creating a new release with a change to the command line driver to allow output to be written to stdout, and also for input to be read from stdin. It should be ready in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants