Package libcore.net.url
Class FtpURLConnection
java.lang.Object
java.net.URLConnection
libcore.net.url.FtpURLConnection
public class FtpURLConnection extends URLConnection
-
Field Summary
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches -
Constructor Summary
Constructors Modifier Constructor Description protectedFtpURLConnection(URL url)FtpURLConnection constructor comment.protectedFtpURLConnection(URL url, Proxy proxy)FtpURLConnection constructor. -
Method Summary
Modifier and Type Method Description voidconnect()Establishes the connection to the resource specified by thisURLStringgetContentType()Returns the content type of the resource.InputStreamgetInputStream()Creates a input stream for writing to this URL Connection.OutputStreamgetOutputStream()Creates a output stream for writing to this URL Connection.PermissiongetPermission()Returns the permission object (in this case, SocketPermission) with the host and the port number as the target name and "resolve, connect" as the action list.voidsetDoInput(boolean newValue)Set the flag if thisURLConnectionsupports input (read).voidsetDoOutput(boolean newValue)Set the flag if thisURLConnectionsupports output(read).Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
Constructor Details
-
FtpURLConnection
FtpURLConnection constructor comment.- Parameters:
url-
-
FtpURLConnection
FtpURLConnection constructor.- Parameters:
url-proxy-
-
-
Method Details
-
connect
Establishes the connection to the resource specified by thisURL- Specified by:
connectin classURLConnection- Throws:
IOException- if an error occurs while connecting to the resource.- See Also:
URLConnection.connected,IOException,URLStreamHandler
-
getContentType
Returns the content type of the resource. Just takes a guess based on the name.- Overrides:
getContentTypein classURLConnection- Returns:
- the value of the response header field
content-type.
-
getInputStream
Creates a input stream for writing to this URL Connection.- Overrides:
getInputStreamin classURLConnection- Returns:
- The input stream to write to
- Throws:
IOException- Cannot read from URL or error creating InputStream- See Also:
URLConnection.getContent(),getOutputStream(),InputStream,IOException
-
getPermission
Returns the permission object (in this case, SocketPermission) with the host and the port number as the target name and "resolve, connect" as the action list.- Overrides:
getPermissionin classURLConnection- Returns:
- the permission object required for this connection
- Throws:
IOException- thrown when an IO exception occurs during the creation of the permission object.
-
getOutputStream
Creates a output stream for writing to this URL Connection.- Overrides:
getOutputStreamin classURLConnection- Returns:
- The output stream to write to
- Throws:
IOException- when the OutputStream could not be created- See Also:
URLConnection.getContent(),getInputStream(),IOException
-
setDoInput
public void setDoInput(boolean newValue)Set the flag if thisURLConnectionsupports input (read). It cannot be set after the connection is made. FtpURLConnections cannot support both input and output- Overrides:
setDoInputin classURLConnection- Parameters:
newValue- *- Throws:
IllegalAccessError- when this method attempts to change the flag after connected- See Also:
URLConnection.doInput,URLConnection.getDoInput(),IllegalAccessError,setDoInput(boolean)
-
setDoOutput
public void setDoOutput(boolean newValue)Set the flag if thisURLConnectionsupports output(read). It cannot be set after the connection is made.\ FtpURLConnections cannot support both input and output.- Overrides:
setDoOutputin classURLConnection- Parameters:
newValue-- Throws:
IllegalAccessError- when this method attempts to change the flag after connected- See Also:
URLConnection.doOutput,IllegalAccessError,setDoOutput(boolean)
-