Click here to Skip to main content
15,741,692 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have working code in C# for read binary data and converted to string

            BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName));
            string data1 = null;
            for (int i = 0x000001; i <= 0x000002; i++)
                br.BaseStream.Position = i;
                data1 += br.ReadByte().ToString("X2");
if (data1 == "0102") label1.Text = "Trees";

i want to making that code working in Java, but i donk know how

What I have tried:

as far i know java use filestream

have some java code but this read whole file

FileInputStream fis = new FileInputStream(myExternalFile);
DataInputStream in = new DataInputStream(fis);
BufferedReader br =
        new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
    myData = myData + strLine;
Updated 26-Feb-17 5:35am

1 solution

Have you thought about Mobile App Development & App Creation Software - Xamarin[^] - it is now part of the Microsoft toolset so you can use C# code!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900