Results 21 to 40 of 63
Thread: FileInputStream question.
- 01-14-2012, 07:09 PM #21
- 01-14-2012, 07:12 PM #22
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
Norm,
There is nothing specific I want to do except learning JAVA.
Why are you answering my questions with questions?
As I was going through the API,
I have seen this method,
and my question is:
and Fuburable's answer, altough not very clear to my as I am a beginner, has at least shown me a way.Why would I create an array and put it into read method as an argument which belongs to a FileInputStreamer object that is referencing to a file ?
Thank you for sparing your time, and trying to help.
- 01-14-2012, 07:16 PM #23
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,386
- Blog Entries
- 7
- Rep Power
- 17
Re: FileInputStream question.
If you want an InputStream that reads from a byte array (not a file), have a look at the ByteArrayInputStream class. (it is also mentioned in the API documentation as a sub class of the InputStream class).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-14-2012, 07:17 PM #24
Re: FileInputStream question.
My questions are to make you think. What is your answer to the last question?
- 01-14-2012, 07:20 PM #25
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
I am not reading anyfile.. I do not want to see its contents.Why are you reading the file? Do you want to see its contents?
Where should read() put the data it reads?
If I were reading it, I guess it would have put it in an byte array.
What is your answer to my question?:
Why would I create an array and put it into read method as an argument which belongs to a FileInputStreamer object that is referencing to a file ?
or I can put it this way:
Why would I ever use this method:
public int read(byte[] b)
that is found in a FileInputStream class ?
- 01-14-2012, 07:26 PM #26
Re: FileInputStream question.
To read bytes from a file.Why would I ever use this method:
- 01-14-2012, 07:27 PM #27
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
- 01-14-2012, 07:29 PM #28
Re: FileInputStream question.
Are you telling me how the read method works?
What is the purpose of the read() method?
- 01-14-2012, 07:31 PM #29
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
not the read() method,
public int read(byte[] b) method..
- 01-14-2012, 07:33 PM #30
Re: FileInputStream question.
That is the method I'm talking about. The one you mentioned in post#25 and I answered in post #26read(byte[] b)
- 01-14-2012, 07:34 PM #31
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
- 01-14-2012, 07:35 PM #32
Re: FileInputStream question.
There must be some examples here. Use Search to find them.
Or use Google.
Better yet, write you own code to read a few bytes into an array and use the Arrays class's toString() method to format that array for printing in a println statement.
- 01-14-2012, 07:37 PM #33
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
There is an answer to everything somewhere in the world.
No one should ask questions to anyone then.. ( Except it is something personal to a specific person.. Like where his wallet is or what his plans are.. )
And if you weren't going to help at the first time, why bother ?
- 01-14-2012, 07:38 PM #34
Re: FileInputStream question.
You are going to have a hard time finding people to help you.
- 01-14-2012, 07:45 PM #35
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
It would have been so much easier if you could have provided a few lines of code.
Obviously I am struggling here, defining myself and understanding this method.
Anyway, difficult is done at once, impossible takes time..
I will find people to help me, believing is everything.. :)
Thanks for your efforts.
- 01-14-2012, 08:05 PM #36
Re: FileInputStream question.
I'm surprised that Search or Google did not return samples.
- 01-14-2012, 08:06 PM #37
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: FileInputStream question.
I did not try.
I really like personal connection.
I will just wait until I make some friends who knows JAVA.
-
Re: FileInputStream question.
Last edited by Fubarable; 01-14-2012 at 08:14 PM.
- 01-14-2012, 08:15 PM #39
Re: FileInputStream question.
There's a saying in sports training: No pain, no gain.
The more effort you put into something the better you will get.
- 01-14-2012, 08:19 PM #40
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Similar Threads
-
FileInputStream
By lakpathy in forum New To JavaReplies: 2Last Post: 01-18-2011, 11:32 AM -
FileInputStream
By lakpathy in forum New To JavaReplies: 4Last Post: 01-17-2011, 12:00 PM -
FileInputStream Problems.
By bayan in forum New To JavaReplies: 18Last Post: 08-11-2010, 11:11 AM -
FileInputStream
By pachufir in forum New To JavaReplies: 3Last Post: 12-11-2009, 05:07 PM -
FileOutputStream > int > FileInputStream
By dudejonne in forum New To JavaReplies: 11Last Post: 11-11-2009, 04:03 PM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks