× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 04/16/2002 at 10:58:31 AM, java400-l-admin@midrange.com wrote:
That's what I guessed too, but I should have really said the object will be
of class FileInputStream - but that still makes little difference in trying
to determine the underlying file name :(
--- end of excerpt ---


Simply use your own objects that are FileInputStreams to
support this behavior.

public class NameableFileInputStream extends FileInputStream {
   String   savedName = null;
   public NameableFileInputStream(String name) {
      super(name);
      savedName = name;
   }
   public String getName() {
      return savedName;
   }
   public static String getName(InputStream obj) {
      String name = null;
      if (obj instanceof NameableFileInputStream) {
         NameableFileInputStream nObj = (NameableFileInputStream)obj;
         return nObj.getName();
      }
      // Or null, or whatever you feel is appropriate
      return "unknown - " + obj.getClass().getName();
   }
}

...Later, where the code needs the name....
name = NameableFileInputStream.getName(inputStream);




In every single ethnic, religious or racial group, there are a
very few truly evil people. For each of those people there
are many, many, many good people.
Assuming anything (evilness or capability for evil) about the
particular group is bigotry and idiocy. Don't do it.  -- Me

Fred A. Kulack  -  IBM eServer iSeries - Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN  (Phone: 507.253.5982   T/L 553-5982)
mailto:kulack@us.ibm.com   Personal: mailto:kulack@magnaspeed.net
AOL Instant Messenger: Home:FKulack  Work:FKulackWrk




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.