fread in java?

Posted on 2006-05-16
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
    LVL 86

    Expert Comment

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

    Expert Comment

    Hi dervisakyuz,

    if you want to read byte array, use :

        // FileInputStream in=new FileInputStream( "<file>" ); // or other stream type
    LVL 13

    Accepted Solution


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    seriesUp challenge 7 81
    method argument as final 1 54
    Fix45 challenge 15 66
    scoresAverage challenge 8 58
    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    729 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

    18 Experts available now in Live!

    Get 1:1 Help Now