1

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?

user2361174
  • 1,872
  • 4
  • 33
  • 51

1 Answers1

0

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?

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • For more functionality I suppose. I'm trying to write production quality program. So I'm trying to take care of different situations, including if someone doesn't pipe in a folder. – user2361174 Jan 27 '14 at 18:23
  • The whole point of piping is to replace user input, but act as if it was user input. That's how all the *NIX tools do it, so what you're trying to do is "wrong". – Kayaman Jan 27 '14 at 19:30