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.URLConnectionThe 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 intDEFAULT_TIMEOUTThe Constant default timeout in milliseconds.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSftpUrlConnection(java.net.URL url)Instantiates a new SFTP URL connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()voiddisconnect()Disconnect.com.jcraft.jsch.ChannelSftpgetChannel()Gets the channel.java.io.InputStreamgetInputStream()protected java.lang.StringgetPath()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:
connectin classjava.net.URLConnection- Throws:
java.io.IOException
-
disconnect
public void disconnect() throws java.io.IOExceptionDisconnect.- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
getChannel
public com.jcraft.jsch.ChannelSftp getChannel() throws java.io.IOExceptionGets the channel.- Returns:
- the channel
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Overrides:
getInputStreamin classjava.net.URLConnection- Throws:
java.io.IOException
-
getPath
protected java.lang.String getPath() throws SftpUrlExceptionGets the path.- Returns:
- the path
- Throws:
SftpUrlException- the SFTP URL exception
-
-