482 |
* @param offset The index into the array to start writing from |
* @param offset The index into the array to start writing from |
483 |
* @param len The number of bytes to write |
* @param len The number of bytes to write |
484 |
*/ |
*/ |
485 |
public synchronized void write(byte[] buf, int offset, int len) |
public synchronized void write (byte[] buffer, int offset, int len) |
486 |
{ |
{ |
487 |
// We actually have to implement this method too. Flush first so that |
// We actually have to implement this method too. Flush first so that |
488 |
// things get written in the right order. |
// things get written in the right order. |
490 |
|
|
491 |
try |
try |
492 |
{ |
{ |
493 |
out.write(buf, offset, len); |
out.write(buffer, offset, len); |
494 |
|
|
495 |
if (auto_flush) |
if (auto_flush) |
496 |
for (int i = offset; i < len; i++) |
for (int i = offset; i < len; i++) |
497 |
if ((buf[i] == '\r') || (buf[i] == '\n')) |
if ((buffer[i] == '\r') || (buffer[i] == '\n')) |
498 |
{ |
{ |
499 |
flush(); |
flush(); |
500 |
break; |
break; |
501 |
} |
} |
502 |
} |
} |
503 |
catch(IOException e) |
catch (IOException e) |
504 |
{ |
{ |
505 |
error_occurred = true; |
error_occurred = true; |
506 |
} |
} |