Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8810197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:04:15+00:00 2026-06-14T03:04:15+00:00

I am going through the oracle API for java.io.RandomAccessFile class. There’s method called read()

  • 0

I am going through the oracle API for java.io.RandomAccessFile class.

There’s method called read() in the class which reads byte of data from the file passed to the constructor:-

public int read()
throws IOException

Reads a byte of data from this file. The byte is returned as an
integer in the range 0 to 255 (0x00-0x0ff). This method blocks if no
input is yet available.

Although RandomAccessFile is not a subclass of InputStream, this
method behaves in exactly the same way as the InputStream.read()
method of InputStream.

Returns:
the next byte of data, or -1 if the end of the file has been reached. Throws:
IOException – if an I/O error occurs. Not thrown if end-of-file has been reached.

I am confused, does it mean to say that it reads 8 bits of data from the file passed to the constructor and convert the read contents to int.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:04:17+00:00Added an answer on June 14, 2026 at 3:04 am

    What is confusing you, exactly?

    Yes, it reads one byte of data, which is 8 bits, and returns it as an integer value in the inclusive range 0..255. So if the file in question happens to be a text file, and the first character is a capital ‘A’, read() will return 65.

    It returns an int instead of a byte so that it can return the full range 0..255 as a positive number, and still have -1 available as a sentinel value for end-of-file (though arguably an exception would have been a better way to do that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going through the Oracle tutorials on Java and there is one thing
I was going through TypeErasure topic at http://download.oracle.com/javase/tutorial/java/generics/erasure.html which says that compiler removes all
Is there any java API/java plugin which can generate Database ER diagram when java
I'm interested in becoming more fluent in Java so I have been going through
Going through the XPath.compile API, I was under the impression that it would return
I'm going through some code that uses the Oracle OCI and I've come across
While going through MSDN I found that in button properties useSubmitBeheviour there is written
I've read through the Oracle documentation concerning the CONNECT operations, but I can't seem
Going through happstack-lite tutorial : we build functions that have return type of ServerPart
Going through some of my older Delphi projects and upgrading them to D2009, as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.