Well I have a HUGE long list of packet sizes that need to be re-written, and I don't want to do it by hand, so I'm going to make a program for it.
public static OutcommingPacket aClass198_1993 = new OutcommingPacket(68, 8);
That's and example of one of the lines, what I need to do, is get the program to go to the 68, store it in the packet string, and the get the number 8, and store that in the size string.
Here is my code so far.
public class PacketSizeFixer {
public static final String IN = "./out/OldPacketSizes.txt";
public static final String OUT = "./out/PacketSizesFormatted.txt";
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(IN));
BufferedReader writer = new BufferedReader(new FileReader(OUT));
String line;
String packet, size;
while ((line = reader.readLine()) != null) {
packet = line.substring(line.indexOf("new OutcommingPacket(", line.indexOf(", ")));
size = line.substring(line.indexOf(", "), line.indexOf(");"));
}
}
}
I'm not sure if im doing it the right way, because I keep getting a String index out of range
please help!
By the way, not all packets have the same name, some are longer, some are shorter, and the packets could be double digits, and so can the sizes. Please help!