Assuming that "filebuffer1" is a BufferedReader, why not get what they want is the way in which the method. ReadLine ()
public String ReadLine ()
throws IOException
Reads a line of text. A line is considered to be terminated by any one of a line feed ( '\ n'), a carriage return ( '\ r'), or a carriage return followed immediately by a linefeed.
Returns:
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Throws:
IOException - If an I / O error occurs
Law and a "single line" and you will return without the carriage return characters from a String object.
You must enter you the terminator line ending at the bottom of the String received.
To avoid mile-milla String (the + operator applied to two creates a third String String that is the result of the first two concatenated in Java String objects are immutable) in your cycle you can declare object "lic" as a StringBuilder and use his method. append () to concatenate the String returned by the BufferedReader, for example:
Code:
Lic StringBuilder = new StringBuilder;
while (filebuffer1.ready ()) (
String line = filebuffer1.readLine ();
lic.append (line) / / concatenate the string read from the buffer
lic.append ( "\ n"); / / concatenate the character to end of line
)
Bookmarks