I have the object URL and needed to encode and then deserialize, how do I do this? The URL is from a server that displays an encoded and serialized Java object.
I have the object URL and needed to encode and then deserialize, how do I do this? The URL is from a server that displays an encoded and serialized Java object.
Maybe that will help you. This code opens an HTTP connection and downloads the content. After that, you should only decode the result. If this does not suit you, please explain further what you are trying to do.
package testes;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class DownloadURL {
public static void main(String[] args) throws IOException {
HttpURLConnection c1 = (HttpURLConnection) new URL("http://grepcode.com").openConnection();
int code1 = c1.getResponseCode();
InputStream resposta = code1 >= 400 ? c1.getErrorStream() : c1.getInputStream();
System.out.println(code1);
StringBuilder sb = new StringBuilder(10240);
int r;
while ((r = resposta.read()) != -1) {
sb.append((char) r);
}
System.out.println(sb);
}
}