blob: 98ab9832cc8c1e14bc4f9aa024419e7c6088c8f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*************************************************************************
/* ContentHandler.java -- Abstract class for handling content from URL's
/*
/* Copyright (c) 1998 Free Software Foundation, Inc.
/* Written by Aaron M. Renn (arenn@urbanophile.com)
/*
/* This library is free software; you can redistribute it and/or modify
/* it under the terms of the GNU Library General Public License as published
/* by the Free Software Foundation, either version 2 of the License, or
/* (at your option) any later verion.
/*
/* This library is distributed in the hope that it will be useful, but
/* WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/* GNU Library General Public License for more details.
/*
/* You should have received a copy of the GNU Library General Public License
/* along with this library; if not, write to the Free Software Foundation
/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
/*************************************************************************/
package java.net;
import java.io.IOException;
/**
* This is an abstract class that is the superclass for classes that read
* objects from URL's. Calling the getContent() method in the URL class
* or the URLConnection class will cause an instance of a subclass of
* ContentHandler to be created for the MIME type of the object being
* downloaded from the URL. Thus, this class is seldom needed by
* applications/applets directly, but only indirectly through methods in
* other classes.
*
* @version 0.5
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class ContentHandler
{
/*************************************************************************/
/*
* Constructors
*/
/**
* Do nothing constructor
*/
public
ContentHandler()
{
;
}
/*************************************************************************/
/**
* This method reads from the InputStream of the passed in URL connection
* and uses the data downloaded to create an Object represening the
* content. For example, if the URL is pointing to a GIF file, this
* method might return an Image object. This method should be overridden
* by subclasses.
*
* @param urlcon A URLConnection object to read data from
*
* @return An object representing the data read
*
* @exception IOException If an error occurs
*/
public abstract synchronized Object
getContent(URLConnection urlcon) throws IOException;
} // class ContentHandler
|