Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: I/O stream question?

  1. #1
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default I/O stream question?

    Hey, just a basic theory question that the text isn't doing a fantastic job of explaining. I know that java I/O streams are used for reading/writing bytes, as opposed to the system.in and system.out which read text from the keyboard. I'm just not understanding the whole "file" idea. Is this program actually reading/writing information from files saves onto your computer? And if so, is it converting it from text, to byte form, and then back to text form again for display in your program? The prof didn't have time to teach this topic, and I'm finding it difficult to understand on my own.

    Thanks a lot!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I/O stream question?

    Everything in a computer and on a disk is bytes made of 8 bits. Much software converts the bytes into human readable form.
    The opposite happens going the other way. When Strings / text are written to disk they are converted to bytes.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: I/O stream question?

    Oh, okay! So the whole purpose for streams is just because these files can be large, and using bytes helps shorten it down. Where exactly is this information going when we use streams, though?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I/O stream question?

    The size of the file has nothing to do with using bytes. No technique for reading the bytes from the file will "shorten" the size of the file. Reading bytes from a file means the programs are getting the bytes that are in a file and copying them into a place in the computer so a program can use them.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member micronome's Avatar
    Join Date
    Dec 2013
    Posts
    1
    My Mood
    Aggressive
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I/O stream question?

    Of course computers process everything as bits. I think you mean that in Java you can read and write data and files in different formats. You can save data in text files and in data files, for example. Depending on the file format you are reading you need different tools (java classes) to read them. After reading you still have to convert data into format that is suitable for you needs, String to int or something else. Normally you can read understandable text file with simple java tools like Scanner class. When reading binary data from files, devices, network or other sources you need some kind of I/O Stream Class to do it and then other Classes to convert the data into an understandable form.

  6. #6
    Member
    Join Date
    Dec 2013
    Location
    Honolulu
    Posts
    83
    Thanks
    1
    Thanked 4 Times in 2 Posts

    Default Re: I/O stream question?

    So theoretically 0 & 1 are stored on HD to be read after. While the whole pictures or video are also stored on a HD but with a different form. When it is time to read it from a HD as 0 & 1, then they are found by names and addresses that identify the file name with the file form itself. Video, text, or picture format. I/O stream files performs these operations on your computer when asked by a user and their input on screen.

  7. #7
    Member
    Join Date
    Dec 2013
    Location
    Honolulu
    Posts
    83
    Thanks
    1
    Thanked 4 Times in 2 Posts

    Default Re: I/O stream question?

    If I wanted to draw this picture on the others PC, it would open up as this UH_newlogo.jpg. UH_newlogo.jpg

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I/O stream question?

    video are also stored on a HD but with a different form
    Everything on a computer and HD are stored as bytes made of 8 bits of 0 and 1.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Read stream of data
    By mapred in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: October 26th, 2012, 12:38 PM
  2. Stream issue?
    By Patrick W in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: August 6th, 2012, 09:27 PM
  3. could not create audio stream from input stream
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 11
    Last Post: June 2nd, 2011, 02:08 AM
  4. UTF - 8 / Byte Stream
    By JavaCODER in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: October 16th, 2010, 02:26 PM
  5. Stream Tokenizer
    By x3rubiachica3x in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: October 12th, 2010, 01:05 PM

Tags for this Thread