• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finding the type of "System.in"

 
Ameet Parande
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In java.lang.System it is defined as a reference to the "InputStream" interface.
On printing it - using a simple print like so:
System.out.println( System.in );
it says it is of type "java.io.BufferedInputStream".
But BufferedInputStream is a decorator - I want to know who is the decoree.
Examaning the class object or using instanceof to does not help since the decoree is contained in the decorator.
Can anyone suggest a way I can find out the type of System.in?
Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to know? It's going to be a non-public class, in any event.
 
Ameet Parande
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was under the impression that it would wrap one of the polular public class from java.io like: ByteArrayInputStream / PipedInputStream etc..
I am not stuck with a problem or anything, I was plainly curious of the implementation of: System.out and System.in :-)
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can download the source code for the SDK and peruse through the .java files if you are interested. I do that myself every now and then when bored or curious of how things are really implemented under the hood.
It's nice not having to worry about implementation details, but it is sometimes fun to find them out!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic