public static Map<String, String> parse(byte[] bytes, String filename) throws PaletteParseException { return PropertiesPaletteParser.parse(bytes); }
public static Map<String, String> parse(InputStream in, String filename) throws IOException, PaletteParseException { DataInputStream dis = new DataInputStream(in); byte[] bytes = new byte[dis.available()]; dis.read(bytes); return parse(bytes, filename); }
public static boolean checkSanity(byte[] bytes) { Properties properties = getProperties(bytes); for (Object value : properties.values()) { if (value.equals("")) { return false; } } return true; }
public static Map<String, String> parse(URL url) { Map<String, String> entries = new HashMap<>(); InputStream in = null; try { in = url.openStream(); entries = parse(in, url.getFile()); } catch (FileNotFoundException e) { log.error("File not found: " + url); } catch (IOException e) { log.error("Could not open file: " + url); } catch (PaletteParseException e) { log.error("Could not parse palette: " + url); } finally { if (in != null) { try { in.close(); } catch (IOException e) { log.error(e, e); } finally { in = null; } } } return entries; }
public static Map<String, String> parse(byte[] bytes) { Map<String, String> entries = new LinkedHashMap<String, String>(); Properties properties = getProperties(bytes); for (Object propertyName : properties.keySet()) { String key = (String) propertyName; entries.put(key, Framework.expandVars((String) properties.get(key))); } return entries; }
Map<String, String> newEntries = PaletteParser.parse(content.getBytes(), myPreset.getSrc()); if (newEntries != null) { allEntries.putAll(newEntries);