summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/gcj/util/path/DirectoryPathEntry.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-03 19:25:13 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-03 19:25:13 +0000
commitfa0c0389856cd16537461344b6c44743b84731a2 (patch)
treeceb7d28c254b76b64efc3bb9f90d8b4d41262884 /libjava/gnu/gcj/util/path/DirectoryPathEntry.java
parentc7f30ba623007a4ca24fb998a2f98ae55595ca31 (diff)
downloadppe42-gcc-fa0c0389856cd16537461344b6c44743b84731a2.tar.gz
ppe42-gcc-fa0c0389856cd16537461344b6c44743b84731a2.zip
Actually removed files which were supposedly
removed a long time ago. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30379 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/util/path/DirectoryPathEntry.java')
-rw-r--r--libjava/gnu/gcj/util/path/DirectoryPathEntry.java136
1 files changed, 0 insertions, 136 deletions
diff --git a/libjava/gnu/gcj/util/path/DirectoryPathEntry.java b/libjava/gnu/gcj/util/path/DirectoryPathEntry.java
deleted file mode 100644
index a9ca602341b..00000000000
--- a/libjava/gnu/gcj/util/path/DirectoryPathEntry.java
+++ /dev/null
@@ -1,136 +0,0 @@
-// DirectoryPathEntry.java -- search path element for directories
-
-/* Copyright (C) 1999 Cygnus Solutions
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-/* Author: Kresten Krab Thorup <krab@gnu.org> */
-
-package gnu.gcj.util.path;
-
-import java.util.*;
-import java.util.zip.*;
-import java.io.*;
-import java.net.*;
-
-final class DirectoryPathEntry extends PathEntry
-{
- final File dir;
- final String base_canon;
-
- public String toString () { return base_canon; }
-
- DirectoryPathEntry (File f)
- throws java.io.IOException
- {
- if (!f.isAbsolute ())
- throw new IllegalArgumentException ();
-
- dir = f;
- base_canon = dir.getCanonicalPath ();
- }
-
- /*
- * We maintain a cache of files, so that we
- * can avoid many calls to stat(), which are
- * very expensive.
- *
- * seen_cache contains (as keys) the directories
- * which we have visited so far. The values are
- * instances of CacheEntry, containing a time stamp,
- * and a list of files in that directory.
- *
- */
-
- private Hashtable seen_cache = new Hashtable ();
-
- private boolean in_cache (File f)
- {
- String rel_dir = f.getParent ();
- CacheEntry ent;
-
- if (rel_dir == null)
- throw new IllegalArgumentException ();
-
- ent = (CacheEntry) seen_cache.get (rel_dir);
- if (ent == null)
- {
- ent = new CacheEntry (rel_dir);
- seen_cache.put (rel_dir, ent);
- }
-
- if (ent.contains (f.getPath ()))
- {
- return true;
- }
-
- if ( ent.is_old () )
- {
- if (f.exists ())
- {
- seen_cache.remove (rel_dir);
- return true;
- }
- else
- {
- ent.touch ();
- }
- }
-
- return false;
- }
-
- URL getURL (String file) {
- try {
- File f = new File((new File (dir, file).getCanonicalPath ()));
-
- if (! f.getCanonicalPath ().startsWith (base_canon))
- throw new IllegalArgumentException (file);
-
-
- if (in_cache (f))
- return new URL ("file", "", f.getPath ());
- else
- return null;
-
- } catch (IOException x) {
- return null;
- }
- }
-
- InputStream getStream (String file) {
- try {
- File f = new File((new File (dir, file)).getCanonicalPath ());
-
- if (! f.getCanonicalPath ().startsWith (base_canon))
- throw new IllegalArgumentException (file);
-
- if (in_cache (f))
- return new FileInputStream (f);
- else
- return null;
- } catch (IOException x) {
- return null;
- }
- }
-
- byte[] getBytes (String file) {
- File f = new File (dir, file);
-
- try {
- if (in_cache (f))
- return readbytes (new FileInputStream (f),
- (int) f.length ());
- else
- return null;
- } catch (IOException x) {
- return null;
- }
- }
-
-}
-
OpenPOWER on IntegriCloud