• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about nullPrintStream class

 
Santhi Bharath
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in which package can i find the nullPrintStream class .which package i have to import to instantiate that class
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no such class in the JDK. Must be in your own code, or some third-party code you are using. For the former, grep your source code. For the latter, try Google.

By the way, the name is probably NullPrintStream, not nullPrintStream. Case matters, in Java. If the name really is nullPrintStream, it is an unconventional (i.e. legal, but bad) class name.
 
Santhi Bharath
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public final static InputStream in = nullInputStream();

public final static PrintStream out = nullPrintStream();

these two are the declarations of "in" and "out" fields in System class

i have copied from the System class definiton file from src of jdk1.5.0

while i am searching in google for nullInputStream class,i have found different third party packages like

org.jboss.util.stream.NullInputStream

can you explain what this party packages and where can i found it in jdk src files and i couldn't found any class NullInputStream in jdk1.5.0 src files.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nullInputStream is not a class, it's a method in the System class.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, looking at the source of the System class, they're very strange methods, too. See the comment above them: -



I don't think there's much to be gained by looking into the detail of these methods. They just look like some nasty hack needed for the special requirements of initialisation of this internal Java implementation class.

If you're looking for a PrintStream that writes to a null device, these System methods do not do that. You're better off looking at one of the examples you already found on the Web.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic