1 11 package org.eclipse.core.internal.resources.refresh.win32; 12 13 import java.io.*; 14 15 19 public class Convert { 20 21 24 private static String defaultEncoding= 25 new InputStreamReader(new ByteArrayInputStream(new byte[0])).getEncoding(); 26 27 34 38 public static byte[] toPlatformBytes(String target) { 39 if (defaultEncoding == null) 40 return target.getBytes(); 41 try { 43 return target.getBytes(defaultEncoding); 44 } catch (UnsupportedEncodingException e) { 45 defaultEncoding = null; 47 return target.getBytes(); 48 } 49 } 50 } 51 | Popular Tags |