Mistři v programování na #hovnokod

Java #75

private static final String PROMPT = " >";
private static final int BUFFER_SIZE = 255;
private static final int NEW_LINE_CHAR = 13;
private static final int CARRIAGE_RETURN_CHAR = 10;
...
System.out.print( prompt + PROMPT );
StringBuffer sb = new StringBuffer();
byte[] buf = new byte[BUFFER_SIZE];
int read = System.in.read( buf );
if ( read != 0 && buf[0] != CARRIAGE_RETURN_CHAR && buf[0] != NEW_LINE_CHAR )
{
    sb.append( new String( buf, 0, read ).trim() );
}
return sb.toString();

Anonymous,