문제

I am writing a program in Java and I want it to accept two different methods of input. One would be piping a file into into the program like this: java program < inputFile.txt Another way I want the input is for the program to wait (in the middle of execution) for the command line input by the user before continuing. Also, I want to process the input differently depending on which method was used.

I've checked myself and both types of input come from System.in. Is there any value in System.in that would depend on the method of input used? If not from System.in, is there any other way to derive a value that's input-method dependent?

도움이 되었습니까?

해결책

No, to the program there is no difference whether input is coming from a user's finger or a pipe. There probably are hacks around this, but the main question is why do you care whether it's one or the other?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top