/[classpath]/inetlib/source/gnu/inet/gopher/GopherContentHandler.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/gopher/GopherContentHandler.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dog, Thu Oct 21 15:21:55 2004 UTC revision 1.5 by dog, Thu Nov 25 22:15:05 2004 UTC
# Line 1  Line 1 
1  /*  /*
2   * $Id$   * GopherContentHandler.java
3   * Copyright (C) 2003 The Free Software Foundation   * Copyright (C) 2003 The Free Software Foundation
4   *   *
5   * This file is part of GNU inetlib, a library.   * This file is part of GNU inetlib, a library.
# Line 49  import java.net.URLConnection; Line 49  import java.net.URLConnection;
49   * This will return either directory listings or input streams.   * This will return either directory listings or input streams.
50   *   *
51   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
  * @version $Revision$ $Date$  
52   */   */
53  public class GopherContentHandler extends ContentHandler  public class GopherContentHandler
54      extends ContentHandler
55  {  {
56    
57    public Object getContent(URLConnection urlc) throws IOException    public Object getContent(URLConnection urlc)
58      {      throws IOException
59        if (urlc instanceof GopherURLConnection)    {
60          {      if (urlc instanceof GopherURLConnection)
61            GopherURLConnection gurlc = (GopherURLConnection) urlc;        {
62            GopherConnection connection = gurlc.connection;          GopherURLConnection gurlc = (GopherURLConnection) urlc;
63            URL url = gurlc.getURL ();          GopherConnection connection = gurlc.connection;
64            String dir = url.getPath ();          URL url = gurlc.getURL();
65            String filename = url.getPath ();          String dir = url.getPath();
66            if (dir == null && filename == null)          String file = url.getFile();
67              {          if (dir == null && file == null)
68                return connection.list ();            {
69              }              return connection.list();
70            else            }
71              {          else
72                return gurlc.getInputStream ();            {
73              }              return gurlc.getInputStream();
74          }            }
75        else        }
76          {      else
77            throw new UnknownServiceException ();        {
78          }          throw new UnknownServiceException();
79      }        }
80      }
81      
82  }  }
83    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26