src/java.base/share/classes/sun/net/www/MimeEntry.java

Print this page
rev 10537 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 271         // return a shallow copy of this.
 272         MimeEntry theClone = new MimeEntry(typeName);
 273         theClone.action = action;
 274         theClone.command = command;
 275         theClone.description = description;
 276         theClone.imageFileName = imageFileName;
 277         theClone.tempFileNameTemplate = tempFileNameTemplate;
 278         theClone.fileExtensions = fileExtensions;
 279 
 280         return theClone;
 281     }
 282 
 283     public synchronized String toProperty() {
 284         StringBuilder sb = new StringBuilder();
 285 
 286         String separator = "; ";
 287         boolean needSeparator = false;
 288 
 289         int action = getAction();
 290         if (action != MimeEntry.UNKNOWN) {
 291             sb.append("action=" + actionKeywords[action]);
 292             needSeparator = true;
 293         }
 294 
 295         String command = getLaunchString();
 296         if (command != null && command.length() > 0) {
 297             if (needSeparator) {
 298                 sb.append(separator);
 299             }
 300             sb.append("application=" + command);
 301             needSeparator = true;
 302         }
 303 
 304         if (getImageFileName() != null) {
 305             if (needSeparator) {
 306                 sb.append(separator);
 307             }
 308             sb.append("icon=" + getImageFileName());
 309             needSeparator = true;
 310         }
 311 
 312         String extensions = getExtensionsAsList();
 313         if (extensions.length() > 0) {
 314             if (needSeparator) {
 315                 sb.append(separator);
 316             }
 317             sb.append("file_extensions=" + extensions);
 318             needSeparator = true;
 319         }
 320 
 321         String description = getDescription();
 322         if (description != null && !description.equals(getType())) {
 323             if (needSeparator) {
 324                 sb.append(separator);
 325             }
 326             sb.append("description=" + description);
 327         }
 328 
 329         return sb.toString();
 330     }
 331 
 332     public String toString() {
 333         return "MimeEntry[contentType=" + typeName
 334             + ", image=" + imageFileName
 335             + ", action=" + action
 336             + ", command=" + command
 337             + ", extensions=" + getExtensionsAsList()
 338             + "]";
 339     }
 340 }


 271         // return a shallow copy of this.
 272         MimeEntry theClone = new MimeEntry(typeName);
 273         theClone.action = action;
 274         theClone.command = command;
 275         theClone.description = description;
 276         theClone.imageFileName = imageFileName;
 277         theClone.tempFileNameTemplate = tempFileNameTemplate;
 278         theClone.fileExtensions = fileExtensions;
 279 
 280         return theClone;
 281     }
 282 
 283     public synchronized String toProperty() {
 284         StringBuilder sb = new StringBuilder();
 285 
 286         String separator = "; ";
 287         boolean needSeparator = false;
 288 
 289         int action = getAction();
 290         if (action != MimeEntry.UNKNOWN) {
 291             sb.append("action=").append(actionKeywords[action]);
 292             needSeparator = true;
 293         }
 294 
 295         String command = getLaunchString();
 296         if (command != null && command.length() > 0) {
 297             if (needSeparator) {
 298                 sb.append(separator);
 299             }
 300             sb.append("application=").append(command);
 301             needSeparator = true;
 302         }
 303 
 304         if (getImageFileName() != null) {
 305             if (needSeparator) {
 306                 sb.append(separator);
 307             }
 308             sb.append("icon=").append(getImageFileName());
 309             needSeparator = true;
 310         }
 311 
 312         String extensions = getExtensionsAsList();
 313         if (extensions.length() > 0) {
 314             if (needSeparator) {
 315                 sb.append(separator);
 316             }
 317             sb.append("file_extensions=").append(extensions);
 318             needSeparator = true;
 319         }
 320 
 321         String description = getDescription();
 322         if (description != null && !description.equals(getType())) {
 323             if (needSeparator) {
 324                 sb.append(separator);
 325             }
 326             sb.append("description=").append(description);
 327         }
 328 
 329         return sb.toString();
 330     }
 331 
 332     public String toString() {
 333         return "MimeEntry[contentType=" + typeName
 334             + ", image=" + imageFileName
 335             + ", action=" + action
 336             + ", command=" + command
 337             + ", extensions=" + getExtensionsAsList()
 338             + "]";
 339     }
 340 }