
org.snapscript.studio.agent.local.message.AttachRequestMarshaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-agent Show documentation
Show all versions of snap-agent Show documentation
Dynamic scripting for the JVM
The newest version!
package org.snapscript.studio.agent.local.message;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URI;
public class AttachRequestMarshaller {
public AttachRequest readRequest(Socket socket) throws IOException {
InputStream stream = socket.getInputStream();
DataInputStream input = new DataInputStream(stream);
String project = input.readUTF();
String host = input.readUTF();
int port = input.readInt();
return new AttachRequest(project, host, port);
}
public void writeRequest(Socket socket, AttachRequest request) throws IOException {
OutputStream stream = socket.getOutputStream();
DataOutputStream output = new DataOutputStream(stream);
String project = request.getProject();
URI root = request.getTarget();
String host = root.getHost();
int port = root.getPort();
output.writeUTF(project);
output.writeUTF(host);
output.writeInt(port);
output.flush();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy