Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I recognize a special delimiter string when reading from a file of strings?
    primarykey
    data
    text
    <p>I want to read strings from a file. When a certain string (<code>&gt;&lt;</code>) is found, I want to start reading integers instead, and convert them to binary strings.</p> <p>My program is reading the strings in and saving them in an <code>ArrayList</code> successfully, but it does not recognise the <code>&gt;&lt;</code> symbol and therefore the reading of the binary strings is not successful.</p> <p>The Code</p> <hr> <pre><code>try { FileInputStream fstream = new FileInputStream(fc.getSelectedFile().getPath()); // Get the object of DataInputStream DataInputStream ino = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(ino)); String ln; String str, next; int line, c =0; while ((ln = br.readLine()) != null) { character = ln; System.out.println(character); iname.add(ln); // arraylist that holds the strings if (iname.get(c).equals("&gt;&lt;")) { break; // break and moves // on with the following while loop to start reading binary strings instead. } c++; } String s = ""; // System.out.println("SEQUENCE of bytes"); while ((line = ino.read()) != -1) { String temp = Integer.toString(line, 2); arrayl.add(temp); System.out.println("telise? oxii"); System.out.println(line); } ino.close(); } catch (Exception exc) { } </code></pre> <p>The file I'm trying to read is for example: </p> <pre><code> T E a v X L A . x "&gt;&lt;" sequence of bytes. </code></pre> <p>Where the last part is saved as bytes and in the textfile appears like that. no worries this bit works. all the strings are saved in a new line. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload