< prev index next >

src/java.desktop/macosx/classes/com/apple/eio/FileManager.java

Print this page




  93      * @since Java for Mac OS X 10.5 - 1.5
  94          * @since Java for Mac OS X 10.5 Update 1 - 1.6
  95      */
  96     public static final short kUserDomain = -32763;
  97 
  98 
  99         /**
 100          * Converts an OSType (e.g. "macs"
 101          * from {@literal <CarbonCore/Folders.h>}) into an int.
 102          *
 103          * @param type the 4 character type to convert.
 104          * @return an int representing the 4 character value
 105          *
 106          * @since Java for Mac OS X 10.5 - 1.5
 107          * @since Java for Mac OS X 10.5 Update 1 - 1.6
 108          */
 109     @SuppressWarnings("deprecation")
 110         public static int OSTypeToInt(String type) {
 111         int result = 0;
 112 
 113                 byte b[] = { (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
 114                 int len = type.length();
 115                 if (len > 0) {
 116                         if (len > 4) len = 4;
 117                         type.getBytes(0, len, b, 4 - len);
 118                 }
 119 
 120                 for (int i = 0;  i < len;  i++)  {
 121                         if (i > 0) result <<= 8;
 122                         result |= (b[i] & 0xff);
 123                 }
 124 
 125         return result;
 126     }
 127 
 128     /**
 129          * Sets the file {@code type} and {@code creator} codes for a file or folder.
 130          *
 131          * @since 1.4
 132          */
 133     public static void setFileTypeAndCreator(String filename, int type, int creator) throws IOException {




  93      * @since Java for Mac OS X 10.5 - 1.5
  94          * @since Java for Mac OS X 10.5 Update 1 - 1.6
  95      */
  96     public static final short kUserDomain = -32763;
  97 
  98 
  99         /**
 100          * Converts an OSType (e.g. "macs"
 101          * from {@literal <CarbonCore/Folders.h>}) into an int.
 102          *
 103          * @param type the 4 character type to convert.
 104          * @return an int representing the 4 character value
 105          *
 106          * @since Java for Mac OS X 10.5 - 1.5
 107          * @since Java for Mac OS X 10.5 Update 1 - 1.6
 108          */
 109     @SuppressWarnings("deprecation")
 110         public static int OSTypeToInt(String type) {
 111         int result = 0;
 112 
 113                 byte[] b = { (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
 114                 int len = type.length();
 115                 if (len > 0) {
 116                         if (len > 4) len = 4;
 117                         type.getBytes(0, len, b, 4 - len);
 118                 }
 119 
 120                 for (int i = 0;  i < len;  i++)  {
 121                         if (i > 0) result <<= 8;
 122                         result |= (b[i] & 0xff);
 123                 }
 124 
 125         return result;
 126     }
 127 
 128     /**
 129          * Sets the file {@code type} and {@code creator} codes for a file or folder.
 130          *
 131          * @since 1.4
 132          */
 133     public static void setFileTypeAndCreator(String filename, int type, int creator) throws IOException {


< prev index next >