Subversion Repositories AndroidProjects

Rev

Rev 221 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.gebauz.Bauzoid.file;

/** File utilities and convenience functions. */
public class FileUtil
{
        private FileUtil() {}
       
        public static String extractPath(String filename)
        {
                for (int n = filename.length()-1; n >= 0; n--)
                {
                        if ((filename.charAt(n) == '\\') ||
                                (filename.charAt(n) == '/'))
                        {
                                return filename.substring(0, n);
                        }
                }
               
                return filename;
        }
       
/*      public static String loadString(FileHandle handle)
        {
                return handle.readString();
        }*/

       
        /** Load a file into a string from assets. */
/*      public static String loadStringFromAsset(Resources resources, String asset) throws IOException
        {
                InputStream is = resources.getAssets().open(asset);
               
                return loadString(is);
        }*/

       
        /** Load a file into a string from resources. */
/*      public static String loadStringFromResource(Resources resources, int id) throws IOException
        {
                InputStream is = resources.openRawResource(id);
               
                return loadString(is);
        }*/

       
/*      public static String loadString(InputStream is) throws IOException
        {
                byte[] buffer = new byte[is.available()];
                is.read(buffer);

                ByteArrayOutputStream os = new ByteArrayOutputStream();
                os.write(buffer);
                os.close();
                       
                is.close();
                       
                return os.toString();
        }*/

       
        /** Load a file from assets. */
/*      public static File loadFileFromAsset(Resources resources, String asset) throws IOException
        {
                InputStream is = resources.getAssets().open(asset);
                return new File(is);
        }*/

       
        /** Load a file from resources. */
/*      public static File loadFileFromResource(Resources resources, int id) throws IOException
        {
                InputStream is = resources.openRawResource(id);
                return new File(is);
        }*/

}