Re: input stream 101
- From: blmblm@xxxxxxxxxxxxx
- Date: 2 Aug 2005 09:21:06 GMT
In article <1122922174.685813.82160@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
hawat.thufir@xxxxxxxxx <hawat.thufir@xxxxxxxxx> wrote:
>blmblm@xxxxxxxxxxxxx wrote:
>...
>> Well, the Web page you cited earlier
>>
>> http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153
>>
>> gives some code I think you could easily adapt -- the code in method
>> run() seems like it's pretty much what you want to do. If you
>> look at it, the variable "url" is actually a String, which is what
>> you want to start with, right? the URL of some HTML to "tidy"?
>> and then it writes its output to a file, which is okay with you,
>> right? So I think you're almost there; you just need to figure
>> out how you want to package this code. Putting it in a main(),
>> with the URL and the output file name as command-line parameters,
>> would be one way. If you want something with a GUI for those
>> two parameters, someone else can maybe help ....
>>
>No GUI, just input/output :)
>
>However, yes, a GUI is something I'm looking into *down the road* but
>getting this to work with the url String hardcoded in is hard enough ;)
>
>I don't know yet how to "package this code," but I do have some general
>ideas:
In case it wasn't clear -- by "package the code" I just mean whether
you want to put it all in a main() method, or in static methods, or
build a proper Java class (with constructor and instance methods and
so forth) or what. In fact, just what you're saying here ....:
>I don't want to deal with an instance of Tidy
>I do want to create my own interface, BasicTidy
>I do want ControlTidy to be all static methods
>I do want ControlTidy to call methods on an object which is of type
>BasicTidy
>I don't know what BasicTidy really needs
>I don't know what kind of objects can be of type BasicTidy
Hm. Why do you want this interface BasicTidy? Maybe you shouldn't
bother, but just define a class that provides only the functionality
you want. If it's an interface, it won't be useful unless you
have at least one class that implements it, and unless you think
that eventually you'll want more than one class that implements it,
what's the point of having a separately-defined interface? (Maybe
someone else will have a better answer for that.)
>(I'm not sure how to say that last one. There's the type (interface)
>of an object, and then its type (instance of).)
I'm not sure either, but I think you have the ideas straight anyway:
For example, if class ControlTidy extends Tidy and implements Runnable
(just an example, don't think this is how you should do things), when
you say
ControlTidy c = new ControlTidy();
you an object that's "really" a ControlTidy, but it could be used as
a ControlTidy, a Tidy, or a Runnable. Or, of course, an Object.
So c points to an object that's an instance of class ControlTidy,
and yet all of the following should evaluate to true:
c instanceof ControlTidy
c instanceof Tidy
c instanceof Runnable
Anyway to get back to your question -- if you define an interface
BasicTidy, then for an object to count as a BasicTidy, it has to
be an instance of a class that implements the BasicTidy interface.
--
| B. L. Massingill
| ObDisclaimer: I don't speak for my employers; they return the favor.
.
- Follow-Ups:
- Re: input stream 101
- From: hawat.thufir@xxxxxxxxx
- Re: input stream 101
- References:
- input stream 101
- From: hawat.thufir@xxxxxxxxx
- Re: input stream 101
- From: hawat.thufir@xxxxxxxxx
- Re: input stream 101
- From: blmblm
- Re: input stream 101
- From: hawat.thufir@xxxxxxxxx
- input stream 101
- Prev by Date: Re: Exception in "Thread-0", NoClassDefFoundError: org/w3c/tidy/Tidy
- Next by Date: Re: Exception in "Thread-0", NoClassDefFoundError: org/w3c/tidy/Tidy
- Previous by thread: Re: jar-in-a-jar again, and manifest questions
- Next by thread: Re: input stream 101
- Index(es):
Relevant Pages
|