String manipulation in Java causes "String index out of range" -


OK, I have a long list of packet size, which needs to be rewritten, and I do not I want to do so by hand, so I am going to create a program for this.

  Public stable out-of-order packet aClass198_1993 = new out-cumming packets (68, 8);   

This is an example of one of the examples, what I have to do, he gets the program to go to 68, it stores it in packet string, and number 8 Public class, PacketSizeFixer {public static final string IN = "./out/OldPacketSizes.txt"

"Public Stable Last String Out =" ./ Out / packetSizesFormatted.txt "; Public Static Zero Main (String [] AGR) throws IOException {BufferedReader Reader = New BufferedR Eader (New FileReader (IN)); BufferedReader Writer = New BufferedReader (New FileReader); String Line; String Packet Size; While ((Line = Reader. Readline)! = Null) {packet = line.substring ( Line.indexOf ("new output packet", line.indexOf (",")); size = line.substring (line .indexOf (","), line.indexOf (");"));}}}

I'm not sure IM is doing the right way because I keep a string out of the index range

please help!

I'm assuming a lot here ...

  while ( (Line = reader.readline ()) = null) {string pair = line.string (line.lastIndexOf ("("), line.lastIndexOf (")")); String value [] = pair.split (","); // value [0] == packet, value [1] == size}    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -