What is OUTPUT_BUFFER_EMPTY in Java?

I am trying to communicate with Arduino from Java. But I can not find a descent explanation of what OUTPUT_BUFFER_EMPTY means?

Does it mean that Java had sent data to Arduino and Arduino read all the data and that is why the PC's otput buffer is now empty? In other words, all the bytes, were successfully transfered from PC to Arduino and PC can start sending new data gain.

all the bytes, were successfully transfered from PC to Arduino

All it means is that the PC's buffer is now empty; whether or not the transfer is successful, the PC can't say, just that all the data it was aked to transmit has left.

Just few more questions.

What happens if I send more data to serial buffer than it can hold?

What is the best way to do output? Send a half of buffer's capacity, than wait for it to go empty, than repeat. Or just ram as much data as you can and just not care at all, since hardware is supposed to handle it for you?

What happens if I send more data to serial buffer than it can hold?

It gets discarded.

What is the best way to do output? Send a half of buffer's capacity, than wait for it to go empty, than repeat. Or just ram as much data as you can and just not care at all, since hardware is supposed to handle it for you?

The best way is through the use of handshaking. The Arduino sends a message to the PC that it is ready to receive data. The PC sends data (no more than the Arduino can handle), and then waits for the Arduino to say that it is ready again.

How does Arduino tell PC that it finished receiving and is ready for more?

That's the bit you have to write.

ok, so Arduuino just sends back CR or any other prearranged byte.