title: spring SFTP create file in remote from byte[]
body: <p>how to create an file in remote directory from byte[], as there is send() methods available in PollableChannel. from below code able to send file to remote, but it's creating an file in local machine. how to avoid creating file in local machine?</p>
  
  <pre><code>PollableChannel remoteFileChannel = context.getBean("outputChannel", PollableChannel.class); 
  
  Message&lt;byte[]&gt; sendFile = MessageBuilder.withPayload("hi how are you".getBytes()).build();
  
  remoteFileChannel.send(sendFile);
  </code></pre>
  
  <p>spring sftp configuration:</p>
  
  <pre><code>&lt;bean id="sftpSessionFactory"
          class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"
          p:host="${sftp.host}"
          p:port="${sftp.port}"
          p:user="${sftp.username}"
          p:password="${sftp.password}"
          p:allowUnknownKeys="${sftp.allowUnknownKeys}" /&gt;
  
  &lt;int:channel id="outputChannel"&gt;
          &lt;int:queue /&gt;
  &lt;/int:channel&gt;
  
  &lt;int-sftp:outbound-channel-adapter id="outboundAdapter"
          session-factory="sftpSessionFactory"
          channel="outputChannel"
          charset="UTF-8"
          remote-directory="${sftp.remotedir}"
          remote-filename-generator="randomFileNameGenerator" /&gt; 
  </code></pre>
  
  <p>how to create an file with random name and write bytes into it?</p>
  
  <p>I have tried with custom file name generator class:</p>
  
  <pre><code>@Component("randomFileNameGenerator")
  public class RandomFileNameGenerator implements FileNameGenerator {
  
      @Override
      public String generateFileName(Message&lt;?&gt; msg) {
          long number = (long) Math.floor(Math.random() * 90000000L) + 1000000L;
          String fileName = String.format("%d.txt", number);
          return fileName;
      }
  
  }
  </code></pre>
  
  <p>where the filename was not setting, creating file with name like "adas-asdfsadf-545sadf.msg". can any one point me where am doing wrong</p>