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 6044323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:59:54+00:00 2026-05-23T06:59:54+00:00

I have a binary file that is created from a program made in Visual

  • 0

I have a binary file that is created from a program made in Visual Basic 5.0. The file just contains a bunch of Long values from the Visual Basic world. I’ve understood that Long in Visual Basic 5.0 is 4 bytes in size, but I do not know the byte order.

I tried parsing the file with DataInputStream using various “read”-methods, but I seem to get “wrong” (i.e. negative) values.

How can I read this and interpret it correctly with Java? What is the byte order for a Long in Visual Basic 5.0?

Below is some kind of code I’m trying to work with; I’m trying to read 2 Long s and print the out on the screen, and then read 2 more etc.

    try {
        File dbFile = new File(dbFolder + fileINA);
        FileInputStream fINA = new FileInputStream(dbFile);
        dINA = new DataInputStream(fINA);
        long counter = 0;

        while (true) {
            Integer firstAddress = dINA.readInt();
            Integer lastAddress = dINA.readInt();

            System.out.println(counter++ + ": " + firstAddress + " " + lastAddress);
        }
    }
    catch(IOException e) {
        System.out.println ( "IO Exception =: " + e );
    }
  • 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-05-23T06:59:55+00:00Added an answer on May 23, 2026 at 6:59 am

    Since VB runs on x86 CPUs, its data types are little-endian. Also, note that a Long in VB is the same size as an int in Java.

    I would try something like this:

    int vbLong = ins.readUnsignedByte() +
                 (ins.readUnsignedByte() << 8) +
                 (ins.readUnsignedByte() << 16) +
                 (ins.readUnsignedByte() << 24);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have response stream from a ftp web request that returns binary file. I
What I have in my project is the binary file that contains list of
I have a binary file that I have to parse and I'm using Python.
I have binary data in a file that I can read into a byte
We have a binary file from which we have identified the following dates (as
I have one binary file which I have created. In it, data is stored
Just because I've never read binary files before I wrote a program that reads
I have a html template that I want to retrieve from the resources file
I have one binary file which I have created. In it, data is stored
I tried to make a program that writes struct elements to binary file and

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.