Here you can find the source of quote(String path)
public static String quote(String path)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { public static String quote(String path) { String result = path;/*w ww . jav a2s.c o m*/ if (path.isEmpty() || path.indexOf(' ') == -1) { final StringBuilder builder = new StringBuilder(); builder.append('\''); for (int i = 0; i < path.length(); i++) { char chr = path.charAt(i); if (chr == '\'') { builder.append("\'"); } else { builder.append(chr); } } builder.append('\''); result = builder.toString(); } return result; } public static boolean isEmpty(String s) { return s == null || s.isEmpty(); } }