Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.google.code.joto.procesors;
 
 import static com.google.code.joto.ReverseEngineerData.concat;
 
 import java.util.Map;
 
public class StringProcessor
    implements CustomProcessor
    public boolean canProcessThisObject objectToProcess )
    {
        return objectToProcess instanceof CharSequence;
    }
    private static Map<CharacterStringreplacementTable = new HashMap<CharacterString>();
    static
    {
        .put'\n'"\\n\"\n + \"" );
        .put'\r'"\\r" );
        .put'\t'"\\t" );
        .put'\\'"\\\\" );
    }

    
    public void processThisObject objectToProcessReverseEngineerData sharedDataint depthLevel,
                             ProcessMoreCallback callback )
        throws Exception
    {
        CharSequence stringToProcess = (CharSequenceobjectToProcess;
        StringBuilder strProcessesed = new StringBuilder( (int) ( stringToProcess.length() * 1.5 ) );
        for ( int i = 0; i < stringToProcess.length(); i++ )
        {
            char c = stringToProcess.charAti );
            String replacementString = .getc );
            if ( replacementString != null )
            {
                strProcessesed.appendreplacementString );
            }
            else
            {
                strProcessesed.appendc );
            }
        }
        
        concatsharedData"\"" + strProcessesed + "\"" );
    }
New to GrepCode? Check out our FAQ X