fread in java?

Posted on 2006-05-16
Last Modified: 2012-08-14
Hello all;

i want to write fread in java

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
    1 Comment
    LVL 11

    Accepted Solution

    This is hardly the place for this question (Java questions belong in the Java TA) but since you asked....
    There is a class in Java called InputStream, and since you can read an array of bytes from it, I don't see why you should need to write any code at all, except that it specifies the array of bytes, and you have size and count.
    int sz = ____________; // set your size to be size * count
    InputFileStream is = new InputFileStream("file.dat");, 0, sz);

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
    C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now