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

com.terracotta.management.resource.services.utils.AttachmentUtils Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.10.9.2
Show newest version
/*
 * 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();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy