io.github.linmoure.utils.CloudFileTools Maven / Gradle / Ivy
package io.github.linmoure.utils;
import io.github.linmoure.constants.Constants;
import lombok.extern.slf4j.Slf4j;
import java.util.Calendar;
@Slf4j
public class CloudFileTools {
/**
* one hundred years
*/
private static final long EXPIRATION_DATE = System.currentTimeMillis() + 3600L * 1000 * 24 * 365 * 100;
public static String genDirByDay() {
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE) + "/";
}
private static String genNewFileName(String fileName) {
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
return Constants.nextId() + fileSuffix;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy