Article View: borland.public.jbuilder.java.language
Article #8474Re: How can I read in file into a byte array?
From: Ben Matterson (Borland)
Date: Fri, 23 Mar 2001 17:46
Date: Fri, 23 Mar 2001 17:46
51 lines
2587 bytes
2587 bytes
Horst Fieseler wrote:
>
> "Ben Matterson (Borland)"
> > How can I read the whole file into the byte array?
> like this:
>
> File fp=new File(fname);
> int flen=(int)fp.length();
> buffer=new byte[flen];
> try{
> BufferedInputStream din=new BufferedInputStream (new
> FileInputStream(fp));
> din.read(buffer,0,flen);
> din.close();
> }
> catch(IOException e){
> System.out.println("e);
> }
>
> Horst
My hero! Thank you very much.
Regards,
Ben
--
InterBase Technical Support
Borland Software Corp.
And now a word from Legal and Marketing...
This e-mail, and any attachments thereto, is intended only for
use by the addressee(s) named herein and may contain legally
privileged and/or confidential information. If you are not the
intended recipient of this e-mail, you are hereby notified that
any dissemination, distribution or copying of this e-mail, and
any attachments thereto, is strictly prohibited. If you have
received this e-mail in error, please immediately and permanently
delete the original and any copy of any e-mail and any printout
thereof.
Accelerate your LinuxοΏ½ application development with Kylix(TM),
the RAD tool for Linux. Easily integrate web, desktop and database
development to quickly deliver fast Linux applications. Kylix is
the only Linux development tool that combines the world's fastest
compiler with the most productive visual design environment for
GUI, web and database programming. Order your copy now!
http://www.borland.com/kylix/
Technical Details
Message-ID:
<3ABB8BF3.9588FDDB@borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes2.visi.com!news-out.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.gwi-ag.com!dnews!10.143.12.142References:
<3AB7BC0C.60473976@borland.com> <3abaf5a7_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,2ea00c6aa2f0fa5a X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-23 11:34:06 PST Message-ID: <3ABB8BF3.9588FDDB@borland.com> Date: Fri, 23 Mar 2001 09:46:27 -0800 From: "Ben Matterson (Borland)" <bmatterson@borland.com> Organization: Borland Software Corp X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: How can I read in file into a byte array? References: <3AB7BC0C.60473976@borland.com> <3abaf5a7_2@dnews> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 10.143.12.142 X-Trace: 23 Mar 2001 09:46:27 -0800, 10.143.12.142 Lines: 51 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes2.visi.com!news-out.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.gwi-ag.com!dnews!10.143.12.142