Class AppleSingle


  • public class AppleSingle
    extends java.lang.Object
    Support reading of data from and AppleSingle source. Does not implement all components at this time, extend as required and/or understood. All construction has been deferred to the read(...) or builder() methods.

    Currently supports entries:
    1. Data Fork
    2. Resource Fork
    3. Real Name
    8. File Dates Info
    11. ProDOS File Info

    See Also:
    AppleCommander issue #20
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AppleSingle.Builder  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<Entry> asEntries​(byte[] data)  
      static java.util.List<Entry> asEntries​(AppleSingleReader reader)  
      static java.util.List<Entry> asEntries​(java.io.File file)  
      static java.util.List<Entry> asEntries​(java.io.InputStream inputStream)  
      static java.util.List<Entry> asEntries​(java.nio.file.Path path)  
      static AppleSingle.Builder builder()  
      byte[] getDataFork()  
      FileDatesInfo getFileDatesInfo()  
      ProdosFileInfo getProdosFileInfo()  
      java.lang.String getRealName()  
      byte[] getResourceFork()  
      static AppleSingle read​(byte[] data)  
      static AppleSingle read​(java.io.File file)  
      static AppleSingle read​(java.io.InputStream inputStream)  
      static AppleSingle read​(java.nio.file.Path path)  
      void save​(java.io.File file)
      Save this AppleSingle to a File.
      void save​(java.io.OutputStream outputStream)
      Write this AppleSingle to the given output stream.
      void save​(java.nio.file.Path path)
      Save this AppleSingle to a Path.
      static boolean test​(byte[] data)
      Perform a quick test against a byte array to see if it is an AppleSingle file.
      static boolean test​(AppleSingleReader reader)
      Perform a quick test against a reader to see if it is an AppleSingle file.
      static boolean test​(java.io.File file)
      Perform a quick test against a File to see if it is an AppleSingle file.
      static boolean test​(java.io.InputStream inputStream)
      Perform a quick test against an InputStream to see if it is an AppleSingle file.
      static boolean test​(java.nio.file.Path path)
      Perform a quick test against a Path to see if it is an AppleSingle file.
      static void write​(java.io.OutputStream outputStream, java.util.List<Entry> entries)
      Common write capability for an AppleSingle based on entries.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDataFork

        public byte[] getDataFork()
      • getResourceFork

        public byte[] getResourceFork()
      • getRealName

        public java.lang.String getRealName()
      • save

        public void save​(java.io.OutputStream outputStream)
                  throws java.io.IOException
        Write this AppleSingle to the given output stream. Note that it only supports the "understood" components.
        Throws:
        java.io.IOException
      • save

        public void save​(java.io.File file)
                  throws java.io.IOException
        Save this AppleSingle to a File.
        Throws:
        java.io.IOException
      • save

        public void save​(java.nio.file.Path path)
                  throws java.io.IOException
        Save this AppleSingle to a Path.
        Throws:
        java.io.IOException
      • write

        public static void write​(java.io.OutputStream outputStream,
                                 java.util.List<Entry> entries)
                          throws java.io.IOException
        Common write capability for an AppleSingle based on entries. Also can be used by external entities to write a properly formatted AppleSingle file without the ProDOS assumptions of AppleSingle.
        Throws:
        java.io.IOException
      • read

        public static AppleSingle read​(java.io.InputStream inputStream)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static AppleSingle read​(java.io.File file)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static AppleSingle read​(java.nio.file.Path path)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static AppleSingle read​(byte[] data)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • asEntries

        public static java.util.List<Entry> asEntries​(java.io.InputStream inputStream)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • asEntries

        public static java.util.List<Entry> asEntries​(java.io.File file)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • asEntries

        public static java.util.List<Entry> asEntries​(java.nio.file.Path path)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • asEntries

        public static java.util.List<Entry> asEntries​(byte[] data)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • asEntries

        public static java.util.List<Entry> asEntries​(AppleSingleReader reader)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • test

        public static boolean test​(java.io.File file)
                            throws java.io.IOException
        Perform a quick test against a File to see if it is an AppleSingle file.
        Throws:
        java.io.IOException
      • test

        public static boolean test​(java.nio.file.Path path)
                            throws java.io.IOException
        Perform a quick test against a Path to see if it is an AppleSingle file.
        Throws:
        java.io.IOException
      • test

        public static boolean test​(java.io.InputStream inputStream)
                            throws java.io.IOException
        Perform a quick test against an InputStream to see if it is an AppleSingle file.
        Throws:
        java.io.IOException
      • test

        public static boolean test​(byte[] data)
        Perform a quick test against a byte array to see if it is an AppleSingle file.
      • test

        public static boolean test​(AppleSingleReader reader)
        Perform a quick test against a reader to see if it is an AppleSingle file.