/* 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
{
	public static void main (String[] args) throws java.lang.Exception
	{
		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
                System.out.println(buffer);
                buffer.position(0).limit(buffer.capacity());
                inicio = fim+1;
            }
            fim++;
        }
	}
}