summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol/file
diff options
context:
space:
mode:
authorNic Ferrier <nferrier@gnu.org>2002-03-19 13:51:53 +0000
committerNic Ferrier <nferrier@gnu.org>2002-03-19 13:51:53 +0000
commite5b9cfdb42164d3a9c045b2ab69489bb2da5bd50 (patch)
treec0358c150a1d1e9fc5f685b89e6c8aba017b9d27 /gnu/java/net/protocol/file
parent78dcb59ff1ec781ca8ce7017198c1895c9971461 (diff)
downloadclasspath-e5b9cfdb42164d3a9c045b2ab69489bb2da5bd50.tar.gz
* gnu/java/net/protocol/file/FileURLConnection.java: Formatting
changes. * gnu/java/net/protocol/file/Handle.java: Formatting changes.
Diffstat (limited to 'gnu/java/net/protocol/file')
-rw-r--r--gnu/java/net/protocol/file/FileURLConnection.java212
-rw-r--r--gnu/java/net/protocol/file/Handler.java131
2 files changed, 152 insertions, 191 deletions
diff --git a/gnu/java/net/protocol/file/FileURLConnection.java b/gnu/java/net/protocol/file/FileURLConnection.java
index ad39fa3c0..826ac51d2 100644
--- a/gnu/java/net/protocol/file/FileURLConnection.java
+++ b/gnu/java/net/protocol/file/FileURLConnection.java
@@ -1,43 +1,44 @@
-/* FileURLConnection.java -- URLConnection class for "file" protocol
- Copyright (C) 1998 Free Software Foundation, Inc.
+/*
+ FileURLConnection.java -- URLConnection class for "file" protocol
+ Copyright (C) 1998 Free Software Foundation, Inc.
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
+ GNU Classpath 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version.
+*/
package gnu.java.net.protocol.file;
+
/**
* This subclass of java.net.URLConnection models a URLConnection via
* the "file" protocol.
@@ -47,100 +48,73 @@ package gnu.java.net.protocol.file;
public class FileURLConnection extends java.net.URLConnection
{
-/*
- * Instance Variables
- */
-
-/**
- * This is a File object for this connection
- */
-private java.io.File file;
+ /**
+ * This is a File object for this connection
+ */
+ private java.io.File file;
-/**
- * InputStream if we are reading from the file
- */
-private java.io.FileInputStream in_stream;
+ /**
+ * InputStream if we are reading from the file
+ */
+ private java.io.FileInputStream in_stream;
-/**
- * OutputStream if we are writing to the file
- */
-private java.io.FileOutputStream out_stream;
+ /**
+ * OutputStream if we are writing to the file
+ */
+ private java.io.FileOutputStream out_stream;
-/*************************************************************************/
+
-/*
- * Constructors
- */
-
-/**
- * Calls superclass constructor to initialize
- */
-protected
-FileURLConnection(java.net.URL url)
-{
- super(url);
-
- /* Set up some variables */
- doOutput = false;
-}
-
-/*************************************************************************/
-/*
- * Instance Methods
- */
+ /**
+ * Calls superclass constructor to initialize.
+ */
+ protected FileURLConnection (java.net.URL url)
+ {
+ super(url);
+ /* Set up some variables */
+ doOutput = false;
+ }
-/**
- * "Connects" to the file by opening it.
- */
-public void
-connect() throws java.io.IOException
-{
- if (!connected)
+ /**
+ * "Connects" to the file by opening it.
+ */
+ public void connect ()
+ throws java.io.IOException
{
file = new java.io.File(getURL().getFile());
- connected = true;
}
-}
-
-/*************************************************************************/
-
-/**
- * Opens the file for reading and returns a stream for it.
- *
- * @return An InputStream for this connection.
- *
- * @exception IOException If an error occurs
- */
-public java.io.InputStream
-getInputStream() throws java.io.IOException
-{
- if (!connected)
- connect();
-
- in_stream = new java.io.FileInputStream(file);
-
- return(in_stream);
-}
-/*************************************************************************/
-
-/**
- * Opens the file for writing and returns a stream for it.
- *
- * @return An OutputStream for this connection.
- *
- * @exception IOException If an error occurs.
- */
-public java.io.OutputStream
-getOutputStream() throws java.io.IOException
-{
- if (!connected)
- connect();
-
- out_stream = new java.io.FileOutputStream(file);
+ /**
+ * Opens the file for reading and returns a stream for it.
+ *
+ * @return An InputStream for this connection.
+ *
+ * @exception IOException If an error occurs
+ */
+ public java.io.InputStream getInputStream ()
+ throws java.io.IOException
+ {
+ if (!connected)
+ connect();
+ in_stream = new java.io.FileInputStream(file);
+ return(in_stream);
+ }
- return(out_stream);
-}
+ /**
+ * Opens the file for writing and returns a stream for it.
+ *
+ * @return An OutputStream for this connection.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public java.io.OutputStream getOutputStream ()
+ throws java.io.IOException
+ {
+ if (!connected)
+ connect();
+ out_stream = new java.io.FileOutputStream(file);
+ return(out_stream);
+ }
} // class FileURLConnection
diff --git a/gnu/java/net/protocol/file/Handler.java b/gnu/java/net/protocol/file/Handler.java
index d1b98c508..176c437fb 100644
--- a/gnu/java/net/protocol/file/Handler.java
+++ b/gnu/java/net/protocol/file/Handler.java
@@ -1,39 +1,41 @@
-/* Handler.java -- "file" protocol handler for java.net
- Copyright (C) 1998 Free Software Foundation, Inc.
+/*
+ Handler.java -- "file" protocol handler for java.net
+ Copyright (C) 1998 Free Software Foundation, Inc.
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ GNU Classpath 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version.
+*/
package gnu.java.net.protocol.file;
@@ -44,51 +46,36 @@ import java.net.URLConnection;
import java.io.IOException;
/**
- * This is the protocol handler for the "file" protocol. It implements
- * the abstract openConnection() method from URLStreamHandler by returning
- * a new FileURLConnection object (from this package). All other
- * methods are inherited
+ * This is the protocol handler for the "file" protocol.
+ * It implements the abstract openConnection() method from
+ * URLStreamHandler by returning a new FileURLConnection object (from
+ * this package). All other methods are inherited
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Handler extends URLStreamHandler
{
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * A do nothing constructor
- */
-public
-Handler()
-{
- ;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * This method returs a new FileURLConnection for the specified URL
- *
- * @param url The URL to return a connection for
- *
- * @return The URLConnection
- *
- * @exception IOException If an error occurs
- */
-protected URLConnection
-openConnection(URL url) throws IOException
-{
- return(new gnu.java.net.protocol.file.FileURLConnection(url));
-}
+ /**
+ * A do nothing constructor
+ */
+ public Handler ()
+ {
+ ;
+ }
+
+ /**
+ * This method returs a new FileURLConnection for the specified URL
+ *
+ * @param url The URL to return a connection for
+ * @return The URLConnection
+ * @exception IOException If an error occurs
+ */
+ protected URLConnection openConnection (URL url)
+ throws IOException
+ {
+ return (new gnu.java.net.protocol.file.FileURLConnection(url));
+ }
} // class Handler