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

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

The 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 - 2025 Weber Informatics LLC | Privacy Policy