Demos and Usage of java.net.URLConnection.getOutputStream()


   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: 
   4:         ...
   5:                     } else if (input instanceof URL){
   6:                         URLConnection con = ((URL)input).openConnection();
   7:                         con.setDoOutput(true);
   8:         ...
   9:                         return con.getOutputStream();
  10:                     } else {

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: 
   4:         ...
   5:     {
   6:         URLConnection connection = url.openConnection();
   7:         connection.setDoOutput(true);
   8:         ...
   9:         return connection.getOutputStream();
  10:     }

View Full Code Here
   1: import java.io.Serializable;
   2: import java.net.URLConnection;
   3: import java.net.HttpURLConnection;
   4:         ...
   5: 
   6:     private URLConnection        mConnection           = null;
   7:     private ObjectOutputStream   mObjectOutStream      = null;
   8:         ...
   9:                                     new BufferedOutputStream(
  10:                                         mConnection.getOutputStream()));
  11:             mObjectOutStream.writeObject(object);

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.security.AccessControlContext;
   4:         ...
   5:          URL url = uri.toURL();
   6:          URLConnection conn = url.openConnection();
   7:          conn.setDoInput(true);
   8:         ...
   9:          URL url = uri.toURL();
  10:          URLConnection conn = url.openConnection();
  11:          conn.setDoOutput(true);
  12:         ...
  13:          conn.connect();
  14:          return conn.getOutputStream();

View Full Code Here
   1: 
   2: import java.net.URLConnection;
   3: import java.net.URL;
   4:         ...
   5: public class DelegatingURLConnection
   6:    extends URLConnection
   7: {
   8:         ...
   9:    protected URL delegateUrl;
  10:    protected URLConnection delegateConnection;
  11: 
  12:         ...
  13:    public OutputStream getOutputStream() throws IOException {
  14:       return delegateConnection.getOutputStream();

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.security.Permission;
   4:         ...
   5: 
   6: public class DelegatingURLConnection extends URLConnection {
   7:     private URL delegateUrl;
   8:         ...
   9:     private URLConnection delegateConnection;
  10: 
  11:         ...
  12:     public OutputStream getOutputStream() throws IOException {
  13:         return delegateConnection.getOutputStream();

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: 
   4:         ...
   5:     private URL                target;
   6:     private URLConnection        conn;
   7:     private ErrorHandler        errHandler;
   8:         ...
   9:         setWriter (new OutputStreamWriter (
  10:             conn.getOutputStream(),
  11:             "UTF8"), "UTF-8");

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.util.Enumeration;
   4:         ...
   5: 
   6:             URLConnection connection = url.openConnection();
   7:             connection.setAllowUserInteraction(false);
   8:         ...
   9:                     connection.setDoOutput(true);
  10:                     IO.copy(in,connection.getOutputStream());
  11:                 }
  12:         ...
  13:             if (proxy_in!=null)
  14:                 IO.copy(proxy_in,response.getOutputStream());

View Full Code Here
   1: 
   2:         URLConnection connection = remoteUrl.openConnection();
   3:         if (connection instanceof HttpURLConnection)
   4:         ...
   5:         {
   6:         connection.getOutputStream().close();
   7:         } 
   8:         ...
   9: 
  10:         OutputStream rout = connection.getOutputStream();

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.net.MalformedURLException;
   4:         ...
   5:     private URL url;
   6:     private URLConnection conn;
   7: 
   8:         ...
   9:         if (isReference()) {
  10:             return ((Resource) getCheckedRef()).getOutputStream();
  11:         }
  12:         ...
  13:         try {
  14:             return conn.getOutputStream();

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: 
   4:         ...
   5:             else {
   6:                 URLConnection connection = url.openConnection();
   7:         ...
   8:                 return connection.getOutputStream();
   9:             }
  10:         ...
  11:             else {
  12:                 URLConnection connection = url.openConnection();

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.net.URLEncoder;
   4:         ...
   5:       URL url = new URL(address);
   6:       URLConnection conn = url.openConnection();
   7:       if (conn instanceof HttpsURLConnection) {
   8:         ...
   9:       OutputStreamWriter out = new OutputStreamWriter(
  10:           conn.getOutputStream(), "UTF8");
  11:       out.write(xmlPacket);
  12:         ...
  13: 
  14:   public static String retrieveHtml(URLConnection http) throws java.io.IOException {

View Full Code Here
   1:             {
   2:                 URLConnection conn = new URL( this.getURL() ).openConnection();
   3:                 String encoding = conn.getContentEncoding();
   4:         ...
   5:         {
   6:             super( conn.getOutputStream(), encoding );
   7:             this.conn = conn;
   8:             Log.info("HttpURLWriter encoding -> " + 
   9:                      encoding + " method -> " + this.conn.getRequestMethod() );

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.util.zip.ZipEntry;
   4:         ...
   5: 
   6: public class ArchiveURLConnection extends URLConnection
   7: {
   8:         ...
   9:     URL url = new URL(nestedURL.toString());
  10:     URLConnection urlConnection = url.openConnection();
  11:     urlConnection.setDoOutput(true);
  12:         ...
  13:     return urlConnection.getOutputStream(); 

View Full Code Here
   1: import java.net.URL;
   2: import java.net.URLConnection;
   3: import java.util.ArrayList;
   4:         ...
   5:     private URLConnectionFactory connectionFactory;
   6:     private URLConnection connection;
   7:     private Proxy proxy;
   8:         ...
   9:             connection =
  10:                 control.createMock(httpConnection ? HttpURLConnection.class : URLConnection.class);
  11:             connectionFactory.createConnection(
  12:         ...
  13:         os = EasyMock.createMock(OutputStream.class);
  14:         connection.getOutputStream();

View Full Code Here