title: jsch inputstream objectoutputstream and unmarshalling
body: <p>We have a scenario where we are attempting to unmarshall a java object, convert it to an inputstream and SFTP it over using JSCH API</p>
  
  <p>BASICALLY -> Our goal is to coerce jSCH into pushing the object in the form of an INPUTSTREAM WITHOUT converting it into a file and then sending it over like in this example here:</p>
  
  <pre><code>// create a session
  session = jsch.getSession(ftpUserName, ftpHost, ftpPort);
  channel = session.openChannel("sftp"); 
  channel.connect(); 
  ChannelSftp sftpTunnel = (ChannelSftp) channel; 
  
  // push the file you created using the channel created by the session
  File f = new File(fileToTransmit); 
  
  
  &gt;&gt; **sftpTunnel.put(new FileInputStream(f), f.getName());** 
  </code></pre>
  
  <p>Except we want to switch out that last line to use the plain-old InputStream  without an association to any file. </p>
  
  <p>According to the jSCH API - NOT using a FileInputStream IS POSSIBLE:</p>
  
  <pre><code>void  put(InputStream src, String dst)
  </code></pre>
  
  <p>Any ideas so as to how we would go about this ?</p>
  
  <p>Could we use an ObjectOutputStream ? Is there a way to take an object and unmarshall it and FEED it to an Inputstream  without EVER creating a file in the intermediate? </p>
  
  <p>Thanks</p>