• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FilterInputStream

 
Hans Li
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to construct an instance of FilterInputStream as
FilterInputStream fi=new FilterInputStream(System.in);
but compiler say it's error.
I don't knoe how to construct it.
Thnak you
 
Oliver Grass
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hans,
you can't create an instance of a FilterInputStream directly, cause the Constructor is protected.
You should use one of the already defined subclasses, for example BufferedInputStream...
Or you can define your own FilterInputStream by subclassing FilterInputStream.
Hope that helps
Oliver
Originally posted by Hans Li:
I want to construct an instance of FilterInputStream as
FilterInputStream fi=new FilterInputStream(System.in);
but compiler say it's error.
I don't knoe how to construct it.
Thnak you

 
Bin Zhao
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pay attention to FileInputStream 's constructors:
FileInputStream(File file)
FileInputStream(FileDescriptor fdObj)
FileInputStream(String name)
System.in is an InputStream
how can it be taken as a parameter to FileInputStream 's constructors?
Bin Zhao
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic