org.mule.transport.sftp
Class SftpInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by org.mule.transport.sftp.SftpInputStream
All Implemented Interfaces:
Closeable, ErrorOccurredDecorator

public class SftpInputStream
extends BufferedInputStream
implements ErrorOccurredDecorator

SftpInputStream wraps an sftp InputStream.


Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
SftpInputStream(SftpClient client, InputStream is, String fileName, boolean autoDelete, ImmutableEndpoint endpoint)
          A special sftp InputStream.
 
Method Summary
 void close()
           
 String getFileName()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void setErrorOccurred()
           
 void setFileName(String fileName)
           
 String toString()
           
 
Methods inherited from class java.io.BufferedInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SftpInputStream

public SftpInputStream(SftpClient client,
                       InputStream is,
                       String fileName,
                       boolean autoDelete,
                       ImmutableEndpoint endpoint)
                throws Exception
A special sftp InputStream. The constructor creates the InputStream by calling SftpClient.retrieveFile(fileName). The client passed in is destroyed when the stream is closed.

Parameters:
client - The SftpClient instance. Will be destroyed when stream closed.
is - The stream that should be used
fileName - name of the file to be retrieved
autoDelete - whether the file specified by fileName should be deleted
endpoint - the endpoint associated to a specific client (connector) pool.
Throws:
Exception - if failing to retrieve internal input stream.
Method Detail

getFileName

public String getFileName()

setFileName

public void setFileName(String fileName)

read

public int read()
         throws IOException
Overrides:
read in class BufferedInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class BufferedInputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class BufferedInputStream
Throws:
IOException

setErrorOccurred

public void setErrorOccurred()
Specified by:
setErrorOccurred in interface ErrorOccurredDecorator

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.