/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.nio.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
StringBuffer texto
= new StringBuffer("Data Valor\n20140901 278\n20140902 248\n20140903 458\n20141004 545\n20141005 125\n20141106 1020\n20141207 249");
CharBuffer buffer = CharBuffer.wrap(texto);
int inicio = 0, fim = 0;
while ( fim < buffer.capacity() ) {
if ( buffer.get(fim) == '\n' ) {
buffer.position(inicio).limit(fim);
// Usa-se buffer como se fosse uma String
buffer.position(0).limit(buffer.capacity());
inicio = fim+1;
}
fim++;
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLm5pby4qOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmdCdWZmZXIgdGV4dG8gPSBuZXcgU3RyaW5nQnVmZmVyKCJEYXRhICAgICAgICAgICAgVmFsb3JcbjIwMTQwOTAxICAgICAgICAyNzhcbjIwMTQwOTAyICAgICAgICAyNDhcbjIwMTQwOTAzICAgICAgICA0NThcbjIwMTQxMDA0ICAgICAgICA1NDVcbjIwMTQxMDA1ICAgICAgICAxMjVcbjIwMTQxMTA2ICAgICAgICAxMDIwXG4yMDE0MTIwNyAgICAgICAgMjQ5Iik7CgogICAgICAgIENoYXJCdWZmZXIgYnVmZmVyID0gQ2hhckJ1ZmZlci53cmFwKHRleHRvKTsKICAgICAgICBpbnQgaW5pY2lvID0gMCwgZmltID0gMDsKICAgICAgICB3aGlsZSAoIGZpbSA8IGJ1ZmZlci5jYXBhY2l0eSgpICkgewogICAgICAgICAgICBpZiAoIGJ1ZmZlci5nZXQoZmltKSA9PSAnXG4nICkgewogICAgICAgICAgICAgICAgYnVmZmVyLnBvc2l0aW9uKGluaWNpbykubGltaXQoZmltKTsKICAgICAgICAgICAgICAgIC8vIFVzYS1zZSBidWZmZXIgY29tbyBzZSBmb3NzZSB1bWEgU3RyaW5nCiAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oYnVmZmVyKTsKICAgICAgICAgICAgICAgIGJ1ZmZlci5wb3NpdGlvbigwKS5saW1pdChidWZmZXIuY2FwYWNpdHkoKSk7CiAgICAgICAgICAgICAgICBpbmljaW8gPSBmaW0rMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW0rKzsKICAgICAgICB9Cgl9Cn0=