I guess this will sound crazy, but I am reading from a file, and it seems like it skips the first line of the file.
What is going on?
Here is the source:
private void loadFile(String fileNPath)
{
StringBuilder currentFileContents = new StringBuilder();
CharBuffer contentsBuffer = CharBuffer.allocate(65536);
int status=0;
try
{
BufferedReader in = new BufferedReader(new FileReader(fileNPath));
while(status!=-1)
{
status=in.read(contentsBuffer);
currentFileContents.append(contentsBuffer);
contentsBuffer.clear();
}
System.out.println(currentFileContents.toString());
}
catch(FileNotFoundException n)
{
//Should be imposible
}
catch(IOException n)
{
n.printStackTrace(System.out);
}
}
It must be something I am over looking.
I copied and pasted the exact source, so I hope this happens for you also.
Thanks,
caalip
I would use FileUtils.readFileToString(file) which does this in one line.
However, when I run your code on a text file I see every line. I suspect the problem is not with your code.