com.terracotta.management.resource.services.utils.AttachmentUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
/*
* All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*/
package com.terracotta.management.resource.services.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author Ludovic Orban
*/
public class AttachmentUtils {
private final static ThreadLocal DATE_FORMATTER = new ThreadLocal() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyyMMddHHmmss");
}
};
public static String createTimestampedZipFilename(String prefix) {
StringBuilder sb = new StringBuilder(prefix);
sb.append("-");
sb.append(DATE_FORMATTER.get().format(new Date()));
sb.append(".zip");
return sb.toString();
}
}