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

History | View | Annotate | Download (2.45 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

    
32

    
33

    
34
/**
35
 * @author gvSIG Team
36
 * @version $Id$
37
 *
38
 */
39
public interface Downloader {
40
    /**
41
     * Downloads an URL into a temporary file that is removed the next time the
42
     * tempFileManager class is called, which means the next time gvSIG is launched.
43
     *
44
     * @param url
45
     * @param name
46
     * @return
47
     * @throws IOException
48
     * @throws ServerErrorResponseException
49
     * @throws ConnectException
50
     * @throws UnknownHostException
51
     */
52
    public File downloadFile(URL url, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException;
53
    
54

    
55
    /**
56
     * Downloads a URL using the HTTP Post protocol
57
     * @param url
58
     * The server URL
59
     * @param data
60
     * The data to send in the request
61
     * @param name
62
     * A common name for all the retrieved files
63
     * @param cancel
64
     * Used to cancel the downloads
65
     * @return
66
     * The retrieved file
67
     * @throws IOException
68
     * @throws ConnectException
69
     * @throws UnknownHostException
70
     */
71
    public File downloadFile(URL url, String data, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException;
72
 
73
    public void removeURL(URL url);
74
    
75
    public void removeURL(Object url);
76
    
77
    /**
78
     * Cleans every temporal file previously downloaded.
79
     */
80
    public void cleanUpTempFiles();
81
       
82

    
83
}