#364 ReadOnlyFile#copyTo/2 should exist

feature_request
open
local elib (53)
5
2008-03-14
2008-03-03
Kevin Reid
No

java.io.File has a sugar method copyTo/2. Since the authority to write is provided as an argument, this message should be implemented for ReadOnlyFile as well.

Discussion

  • Mark Samuel Miller

    • assigned_to: nobody --> caplet
     
  • Kevin Reid

    Kevin Reid - 2008-03-14

    Logged In: YES
    user_id=206335
    Originator: YES

    This seems to work:

    Index: jsrc/org/erights/e/meta/java/io/ReadOnlyFile.java

    --- jsrc/org/erights/e/meta/java/io/ReadOnlyFile.java (revision 485)
    +++ jsrc/org/erights/e/meta/java/io/ReadOnlyFile.java (working copy)
    @@ -13,6 +13,7 @@
    import org.erights.e.elib.tables.AssocFunc;
    import org.erights.e.elib.tables.EIteratable;
    import org.erights.e.elib.tables.Twine;
    +import org.erights.e.elib.util.OneArgFunc;

    import java.io.BufferedReader;
    import java.io.File;
    @@ -222,6 +223,12 @@
    return FileSugar.getBytes(myPrecious);
    }

    + public void copyTo(File dest, OneArgFunc optEjector) {
    + // Even though this is a "write" operation, its authorization is the
    + // dest argument, so it is safe to provide on read-only files.
    + FileSugar.copyTo(myPrecious, dest, optEjector);
    + }
    +
    /**
    * If the file is a directory, enumerate filename => File associations
    * for each child of the directory.

     

Log in to post a comment.