Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.analogweb.acf;
  
  import static org.analogweb.acf.CommonsFileUploadModulesConfig.PLUGIN_MESSAGE_RESOURCE;
  
  import java.util.Iterator;
  import java.util.List;
 import java.util.Map;
 

Author(s):
snowgooseyk
 
 
     private static final Log log = Logs.getLog(FileItemMultipartParameters.class);
     private final List<FileItemMultipartmultiparts;
     private final String encoding;
     private Map<StringString[]> params;
     private Map<StringFileItemMultipart[]> files;
 
     public FileItemMultipartParameters(List<FileItemitemsString encoding) {
         this. = toMultiparts(items);
         this. = encoding;
     }
 
     protected List<FileItemMultiparttoMultiparts(List<FileItemitems) {
         final List<FileItemMultipartmultiparts = new LinkedList<FileItemMultipart>();
         for (final FileItem item : items) {
             multiparts.add(new FileItemMultipart(item));
         }
         return multiparts;
     }
 
     @Override
     public Iterator<FileItemMultipartiterator() {
         return .iterator();
     }
 
     @Override
     public String[] getParameter(String name) {
         return getParameterMap().get(name);
     }
 
     @Override
     public Collection<StringgetParameterNames() {
         return getParameterMap().keySet();
     }
 
     @Override
     public Map<StringString[]> getParameterMap() {
         extractParameters();
         return this.;
     }
 
     @Override
     public FileItemMultipart[] getMultiparts(String name) {
         return asMap().get(name);
     }
 
     @Override
         return asMap().keySet();
     }
 
     public Map<StringFileItemMultipart[]> asMap() {
         extractParameters();
         return this.;
     }
 
     private void extractParameters() {
         if (this. != null || this. != null) {
             return;
         }
         this. = Maps.newEmptyHashMap();
         this. = Maps.newEmptyHashMap();
         for (final FileItemMultipart param : this) {
             final String paramName = param.getName();
             if (param.isMultipartFile()) {
                 .log("TACF000002"new Object[] { paramName });
                 if (this..containsKey(paramName) == false) {
                     this..put(paramNamenew FileItemMultipart[0]);
                 }
                 final FileItemMultipart[] fileArray = this..get(paramName);
                 this.
                 .put(paramName, ArrayUtils.add(FileItemMultipart.classparamfileArray));
             } else {
                 .log("TACF000001"new Object[] { paramName });
                 if (this..containsKey(paramName) == false) {
                     this..put(paramNamenew String[0]);
                 }
                 final String[] array = this..get(paramName);
                try {
                    this..put(paramName, ArrayUtils.add(String.class,
                            new String(param.getBytes(), ), array));
                } catch (final UnsupportedEncodingException e) {
                    throw new FileUploadFailureException(e);
                }
            }
        }
    }
New to GrepCode? Check out our FAQ X