Article View: borland.public.jbuilder.java.language
Article #18735Re: InputStream versus FileInputStream
From: Clint Brewer
Date: Thu, 07 May 1998 00:00
Date: Thu, 07 May 1998 00:00
39 lines
1880 bytes
1880 bytes
Howard Weiner wrote: > > Hi, > > Hope someone can answer this.... > > The definition for System.in is > > public static final InputStream in = new InputStream(); > > But, class InputStream is abstract. In fact, it is the intended superclass > of all derived input stream subclasses. Shouldn't the definition for > System.in be: > > public static final FileInputStream in = new > FileInputStream(0); > > What am I missing here? > > TIA. > > HDW Hello Howard, Well, I went and looked arround on sun's site, and there seems to be no mention of the strangeness that System.in is defined to be the abstract class InputStream. Just from looking at the api, and reading about System, my guess would be that System actually defines a special imput stream that deals with whichever system it is running on, and since you cannot instantiate System, they just left it defined to be InputStream, so that you can reassign it to be whatever stream extending InputStream that you want to assign it. It's like a reference to an input stream, if you will. It refers to your keyboard by default, but can be reassigned to whatever InputStream decendat yuo wish. hope that shines a little light in. I'll post if I find out more, Clint Brewer
Technical Details
Message-ID:
<355298CB.33FA@borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6istfm$858@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,1d7629f860dcc0d1 X-Google-Attributes: gidf74b3,public From: Clint Brewer <supportinfo@borland.com> Subject: Re: InputStream versus FileInputStream Date: 1998/05/07 Message-ID: <355298CB.33FA@borland.com> X-Deja-AN: 351334685 Content-Transfer-Encoding: 7bit References: <6istfm$858@forums.borland.com> Mime-Version: 1.0 To: Howard Weiner <HDWeiner@erols.com> Content-Type: text/plain; charset=us-ascii Organization: Borland International Newsgroups: borland.public.jbuilder.java.language