java - How to continue looping through DataInputStream? -


I am reading a binary file and I have to parse this file in the header.

Set up a DataInputStream and I need to keep looping through the file till the end. I'm new in Java so I'm not sure how I will achieve this from my own C # experience. At the moment I have the following code:

  while (is.position! = Is.length) {if (card == employee) {System.out.print (card); } And if (card == student) {System.out.print (card); } And if (card == admin) {System.out.print (card); } Else {System.out.print ("wrong"); }}   

is the input stream I have created, the only error I have is in the first line, where the loop of time starts under the condition and it It says that they can not be solved or there is no field.

Given this, it is the location field of DataInputStream Perhaps you can use one of the other ways to check whether or not available, but this is not clear from your code sample what you are trying to do.

There are currently many issues like I card , employee , student and admin

  1. Code> type string , you have to compare them using the par (string s) method, not == <
  2. You do not seem to be repeated in your loop. If you do nothing to change the value of is.position (I know that it does not actually exist, but hypothetically speaking ...) so if you can enter the loop then You'll never leave it.
  3. You do not change the value of card . If you repeat a certain number, you will only continue to print the same output that is repeatedly printed, which may The purpose is not to be.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -