Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.compat / org.gvsig.compat.api / src / main / java / org / gvsig / compat / net / Downloader.java @ 47844

History | View | Annotate | Download (3.21 KB)

1 40559 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3 40435 jjdelcerro
 *
4 40559 jjdelcerro
 * Copyright (C) 2007-2013 gvSIG Association.
5 40435 jjdelcerro
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8 40559 jjdelcerro
 * as published by the Free Software Foundation; either version 3
9 40435 jjdelcerro
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21 40559 jjdelcerro
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23 40435 jjdelcerro
 */
24
package org.gvsig.compat.net;
25
26
import java.io.File;
27
import java.io.IOException;
28
import java.net.ConnectException;
29
import java.net.URL;
30
import java.net.UnknownHostException;
31 47839 jjdelcerro
import org.apache.http.entity.ContentType;
32 40435 jjdelcerro
33
34
35
/**
36
 * @author gvSIG Team
37
 * @version $Id$
38
 *
39
 */
40
public interface Downloader {
41
    /**
42
     * Downloads an URL into a temporary file that is removed the next time the
43
     * tempFileManager class is called, which means the next time gvSIG is launched.
44
     *
45
     * @param url
46
     * @param name
47 42543 jjdelcerro
     * @param cancel
48 40435 jjdelcerro
     * @return
49
     * @throws IOException
50
     * @throws ConnectException
51
     * @throws UnknownHostException
52
     */
53
    public File downloadFile(URL url, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException;
54
55
56
    /**
57
     * Downloads a URL using the HTTP Post protocol
58
     * @param url
59
     * The server URL
60
     * @param data
61
     * The data to send in the request
62
     * @param name
63
     * A common name for all the retrieved files
64
     * @param cancel
65
     * Used to cancel the downloads
66
     * @return
67
     * The retrieved file
68
     * @throws IOException
69
     * @throws ConnectException
70
     * @throws UnknownHostException
71
     */
72
    public File downloadFile(URL url, String data, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException;
73 42140 jjdelcerro
74
    public File downloadFile(URL url, String data, String name, ICancellable cancel, int maxbytes) throws IOException,ConnectException, UnknownHostException;
75
76 47839 jjdelcerro
    public File downloadFile(URL url, String method, ContentType contentType, String data, String name, ICancellable cancel) throws IOException, ConnectException, UnknownHostException;
77
78
    public File downloadFile(URL url, String method, ContentType contentType, String data, String name, ICancellable cancel,int maxbytes) throws IOException, ConnectException, UnknownHostException;
79
80 47844 fdiaz
    public File downloadFile(URL url, String method, ContentType contentType, String data, String name, ICancellable cancel,int maxbytes, boolean useCache) throws IOException, ConnectException, UnknownHostException;
81
82 40435 jjdelcerro
    public void removeURL(URL url);
83
84
    public void removeURL(Object url);
85
86
    /**
87
     * Cleans every temporal file previously downloaded.
88
     */
89
    public void cleanUpTempFiles();
90
91
92
}