// Utility method used by viewId conversion. Appends the extension // if no extension is present. Otherwise, replaces the extension. private void appendOrReplaceExtension( String viewId, String ext, int length, int extIdx, StringBuilder buffer) { buffer.setLength(0); buffer.append(viewId); if (extIdx != -1) { buffer.replace(extIdx, length, ext); } else { // no extension in the provided viewId, append the suffix buffer.append(ext); } }