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 java.net.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.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SftpUrlConnection(java.net.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.java.io.InputStream
getInputStream()
protected java.lang.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
-
-
Method Detail
-
connect
public void connect() throws java.io.IOException
- Specified by:
connect
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
disconnect
public void disconnect() throws java.io.IOException
Disconnect.- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
getChannel
public com.jcraft.jsch.ChannelSftp getChannel() throws java.io.IOException
Gets the channel.- Returns:
- the channel
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Overrides:
getInputStream
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getPath
protected java.lang.String getPath() throws SftpUrlException
Gets the path.- Returns:
- the path
- Throws:
SftpUrlException
- the SFTP URL exception
-
-