fread in java?

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 ?
dervisakyuzAsked:
Who is Participating?
 
CEHJCommented:
I posted how to read the binary data you need using DataInputStream.readShort in your other question
0
 
WebstormCommented:
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);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.