String str = "";
try {
BufferedReader br = new BufferedReader(new FileReader(file.getAbsolutePath()));
while (br.readLine() != null) {
str += br.readLine();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String replace = str.replace("HTTP Request: ", "")
.replace("Resource URL: ","")
.replace("Attribute\t\tDescription", "| Attribute | Type | Description |<P>|----|----|<P>")
.replace("Data Type | Max Length | Requirement |", "")
.replace("N/A", "Object")
.replace("String", "| String")
.replace("255 |", "")
.replace("Required", "**Required**")
.replace("Optional", "**Optional**")
.replace("Request Example <P>", "")
.replace("Response Example <P>", "Nothing");
PrintWriter pw = null;
The BufferedReader ignores the first 3 lines and reads/converts the rest. Not sure as to what the issue is. I have tried other StackOverflow solutions but none of them seem to work!
The problem is here:
while (br.readLine() != null)
The time that you check if the br.readLine() is not null you have already read the line.To fix this you can try the following:
String line = br.readLine();
while (line != null){
str +=line;
line = br.readLine();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With