All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.linmoure.utils.CloudFileTools Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
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