Package org.opennms.protocols.sftp
Class SftpUrlConnection
- java.lang.Object
-
- java.net.URLConnection
-
- org.opennms.protocols.sftp.SftpUrlConnection
-
- Direct Known Subclasses:
Sftp3gppUrlConnection
public class SftpUrlConnection extends URLConnection
The class for managing SFTP URL Connection.The default connection timeout is 30 seconds.
- Author:
- Alejandro Galue
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_TIMEOUT
The Constant default timeout in milliseconds.-
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SftpUrlConnection(URL url)
Instantiates a new SFTP URL connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
void
disconnect()
Disconnect.com.jcraft.jsch.ChannelSftp
getChannel()
Gets the channel.InputStream
getInputStream()
protected String
getPath()
Gets the path.-
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
The Constant default timeout in milliseconds.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SftpUrlConnection
protected SftpUrlConnection(URL url)
Instantiates a new SFTP URL connection.- Parameters:
url
- the URL
-
-
Method Detail
-
connect
public void connect() throws IOException
- Specified by:
connect
in classURLConnection
- Throws:
IOException
-
disconnect
public void disconnect() throws IOException
Disconnect.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getChannel
public com.jcraft.jsch.ChannelSftp getChannel() throws IOException
Gets the channel.- Returns:
- the channel
- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
- Overrides:
getInputStream
in classURLConnection
- Throws:
IOException
-
getPath
protected String getPath() throws SftpUrlException
Gets the path.- Returns:
- the path
- Throws:
SftpUrlException
- the SFTP URL exception
-
-