Java Path Create makePath(String filename, String savePath)

Here you can find the source of makePath(String filename, String savePath)

Description

make Path

License

Open Source License

Declaration

public static String makePath(String filename, String savePath) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static String makePath(String filename, String savePath) {

        int hashcode = filename.hashCode();
        int dir1 = hashcode & 0xf; // 0--15
        int dir2 = (hashcode & 0xf0) >> 4; // 0-15

        String dir = savePath + File.separator + dir1 + File.separator + dir2;

        File file = new File(dir);

        if (!file.exists()) {

            file.mkdirs();//from w w  w. j a  va 2s.  c  o  m
            file.setWritable(true, false);
        }
        return dir;
    }
}

Related

  1. makePath(Collection files)
  2. makePath(File copyTo)
  3. makePath(File cwd, String path)
  4. makePath(final String dir, final String... jars)
  5. makePath(String basePath)
  6. makePath(String path1, String path2)
  7. makePath(String... elements)
  8. makePath(String... elements)
  9. makePath(String[] strings)