How to send data to and from java

Hey.
As the title says im wondering what the fastest / best way to read and write data to flash from java is.

Currently im doing it this way.

[AS]
// FLASH Sending message
public function sendMessage( message:String ) {
message = message + "
";
socket.writeUTFBytes( message ); // write string to socket
socket.flush(); // makes sure it is sent right away
}
// Flash reading data
private function socketData( event:ProgressEvent ):void {
// read all data available and send string to function to take care of it
receiveMessage( socket.readUTFBytes( socket.bytesAvailable ) );
}
[/AS]
[AS]
// JAVA reading data (this part is inside a thread)
in = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
String line;
while((line = in.readLine()) != null){ // waits untill data is available
de.takecareofmessage(line, mySocket);
}
//JAVA send data.
public void sendData(Socket s, String data){
try {
// supposed to make window size infiniteā€¦ no noticable effect
s.setTcpNoDelay(true);
PrintWriter out = new PrintWriter(s.getOutputStream());
out.print(data); // write the string
out.flush(); // make sure data is sent right away
} catch (IOException e) {
e.printStackTrace();
}
}
[/AS]

This is working right now, and im receiving messages as they should be.
As for speed and bandwidth utilization im not sure if its all that good?

id prefeer these methods to be as fast and bandwidth cheap as possibleā€¦
Help please?