Java Utililty Methods Socket Write

List of utility methods to do Socket Write

Description

The list of methods to do Socket Write are organized into topic(s).

Method

voidcopy(final Socket inputSocket, final Socket outputSocket)
Copy data from input socket to output socket
InputStream inputStream = null;
OutputStream outputStream = null;
try {
    inputStream = inputSocket.getInputStream();
    outputStream = outputSocket.getOutputStream();
    final byte buf[] = new byte[3000];
    int length;
    while (true) {
...
ObjectOutputStreamcreateObjectOutputStream(Socket socket)
create Object Output Stream
return new ObjectOutputStream(socket.getOutputStream());
PrintWritercreateWriter(Socket socket)
create Writer
return new PrintWriter(socket.getOutputStream());
OutputStreamgetOutputStream(Socket socket)
get Output Stream
try {
    return socket.getOutputStream();
} catch (IOException e) {
    e.printStackTrace();
return null;
OutputStreamgetOutputStreamFromSocket(final Socket socket)
Returns a OutputStream from the specified socket
return socket.getOutputStream();
PrintWritergetWriter(Socket socket)
Make a PrintWriter to send outgoing data.
return (new PrintWriter(socket.getOutputStream(), true));
PrintWriteropenWriter(Socket socket)
open Writer
PrintWriter writer = new PrintWriter(socket.getOutputStream(), true);
return writer;
voidwriteData(Socket id, byte[] data, int len)
Method writeData
OutputStream output;
output = id.getOutputStream();
output.write(data, 0, len);
voidwriteDatasIntoSocket(Socket socket, String datas)
write Datas Into Socket
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
dos.writeBytes(datas);
dos.flush();
voidwriteFromServer(Socket sck, String row)
write From Server
PrintStream out = new PrintStream(new BufferedOutputStream(sck.getOutputStream()));
for (int i = 0; i < 100; i++) {
    out.print(row);
    out.print("\r\n");
out.flush();