• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

FilterInputStream

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic