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 @ 47839

History | View | Annotate | Download (3 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
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
 * as published by the Free Software Foundation; either version 3
9
 * 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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
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
import org.apache.http.entity.ContentType;
32

    
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
     * @param cancel
48
     * @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

    
74
    public File downloadFile(URL url, String data, String name, ICancellable cancel, int maxbytes) throws IOException,ConnectException, UnknownHostException;
75

    
76
    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
    public void removeURL(URL url);
81
    
82
    public void removeURL(Object url);
83
    
84
    /**
85
     * Cleans every temporal file previously downloaded.
86
     */
87
    public void cleanUpTempFiles();
88
       
89

    
90
}