How do you read successive lines of linefeed-delimited text using a BlobstoreInputStream?
I would like to read a line of text at a time from the Blobstore using a BlobstoreInputStream and process the text
123,ABC,DEF,GHI,JKL,123,456,789,123\r\n
But the BlobstoreInputStream read
methods don't offer the option to read successive 开发者_高级运维chunks of delimited data based on a delimiter (\r\n
in this case).
Is there a way to programmatically use one of the available read
methods to do this:
public int read() throws java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
Does the BlobstoreInputStream extend the Stream interface? If it does you could pass it into the constructor of a new Scanner, or a BufferedInputReader class, those each have a ReadLine() method or something similar.
I personally like the Scanner class because the conventional while loop for that is
while(scanner.hasNextLine()){
String s = scanner.NextLine();
....
}
精彩评论