[Last Call] Learn how to a build a cloud-first strategyRegister Now


fread in java?

Posted on 2006-05-16
Medium Priority
Last Modified: 2012-05-05
i want to write "fread" in java
c++ i s here;
int  fread (void * buffer, size_t size, size_t count, FILE * stream);
Read block of data from a stream.
  Read count number of items each one with a size of size bytes from the stream and stores it in the specified buffer.
  Stream's postion indicator is increased by the number of bytes readed.
  Total amount of bytes read is (size x count).

how can i do it ?
Question by:dervisakyuz
  • 2
LVL 86

Expert Comment

ID: 16688887
I posted how to read the binary data you need using DataInputStream.readShort in your other question
LVL 13

Expert Comment

ID: 16689338
Hi dervisakyuz,

if you want to read byte array, use InputStream.read :

    // FileInputStream in=new FileInputStream( "<file>" ); // or other stream type
    int n_read=in.read(buffer,offset,size);
LVL 13

Accepted Solution

Webstorm earned 1000 total points
ID: 16689360

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question