Example usage for org.apache.commons.collections.bidimap DualHashBidiMap values

List of usage examples for org.apache.commons.collections.bidimap DualHashBidiMap values

Introduction

In this page you can find the example usage for org.apache.commons.collections.bidimap DualHashBidiMap values.

Prototype

public Collection values() 

Source Link

Document

Gets a values view of the map.

Usage

From source file:eu.scape_project.archiventory.identifiers.UnixFileIdentification.java

@Override
public HashMap<String, List<String>> identifyFileList(DualHashBidiMap fileRecidBidiMap) throws IOException {
    HashMap<String, List<String>> resultMap = new HashMap<String, List<String>>();
    String ufidRes = this.identify(fileRecidBidiMap.values());
    Scanner s = new Scanner(ufidRes);
    // one file identification result per line
    s.useDelimiter("\n");
    while (s.hasNext()) {
        // output syntax of the unix-tool 'file' is ${fileName} : ${mimeType}
        StringTokenizer st = new StringTokenizer(s.next(), ":");
        String fileName = st.nextToken().trim();
        // output key
        String key = (String) fileRecidBidiMap.getKey(fileName);
        if (key != null) {
            String containerFileName = key.substring(0, key.indexOf("/"));
            String containerIdentifier = key.substring(key.indexOf("/") + 1);
            String outputKey = String.format(outputKeyFormat, containerFileName, containerIdentifier);
            // output value
            String property = "mime";
            String value = st.nextToken().trim();
            String outputValue = String.format(outputValueFormat, tool, property, value);
            List<String> valueLineList = new ArrayList<String>();
            valueLineList.add(outputValue);
            resultMap.put(outputKey, valueLineList);
        } else {//from   w w  w  .ja v  a2 s . c  o m
        }
    }
    return resultMap;
}