Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.transistore.service.cfg;
 
 
We need a custom converter since basic EntryKey does not have functionality for generic "as String" functionality. Plus we could make filenames bit more aesthetically pleasing...
    protected final EntryKeyConverter<BasicTSKey_keyConverter;
    
    {
         = keyConverter;
    }
    
    @Override
    public StringBuilder appendFilename(StorableKey rawKeyfinal StringBuilder sb)
    {
        BasicTSKey key = .rawToEntryKey(rawKey);
        final char safeChar = ;
        // Start with partition id, if any
        final String fullPath = key.getPartitionAndPath();
        final int groupLen = key.getPartitionIdLength();
        if (groupLen > 0) {
            sb.append(groupLen);
        }
        sb.append(':');
        
        for (int i = 0, len = fullPath.length(); i < len; ++i) {
            char c = fullPath.charAt(i);
            if ((c <= 0xFF) && isSafe((bytec)) {
                sb.append(c);
            } else {
                sb.append(safeChar);
            }
        }
        return sb;
    }
New to GrepCode? Check out our FAQ X