+ return new File(file, getFileName(id));
+ }
+
+ //
+ // PRIVATE METHODS
+ //
+
+ /**
+ * Returns the relative name of the directory that the file for the given ID
+ * will be stored in.
+ *
+ * @param id
+ * The ID of the file to store
+ * @return The name of the directory to store the file in
+ */
+ private String getDirectoryName(String id) {
+ String realId = id.replaceAll("-", "").toLowerCase();
+ return realId.substring(0, 2) + "/" + realId.substring(2, 4) + "/" + realId.substring(4, 6) + "/" + realId.substring(6, 8);
+ }
+
+ /**
+ * Returns the name of the file for the given ID, relative to its
+ * {@link #getDirectoryName(String) directory}.
+ *
+ * @param id
+ * The ID of the file to store
+ * @return The name of the file to store the file in
+ */
+ private String getFileName(String id) {
+ String realId = id.replaceAll("-", "").toLowerCase();
+ return realId.substring(8);