Package com.atlauncher.exceptions

Examples of com.atlauncher.exceptions.ChunkyException


    public static StyleSheet makeStyleSheet(String name) {
        try {
            if (resources.containsKey(name)) {
                Object obj = resources.get(name);
                if (!(obj instanceof StyleSheet)) {
                    throw new ChunkyException("Reference for " + name + " ended up with a bad value, " +
                            "suggested=" + StyleSheet.class.getName() + "; got=" + obj.getClass().getName());
                } else {
                    return (StyleSheet) obj;
                }
            } else {
                StyleSheet sheet = new StyleSheet();
                Reader reader = new InputStreamReader(System.class.getResourceAsStream("/assets/css/" + name + ".css"));
                sheet.loadRules(reader, null);
                reader.close();

                resources.put(name, sheet);
                return sheet;
            }
        } catch (Exception ex) {
            throw new ChunkyException(ex);
        }
    }
View Full Code Here


    public static Font makeFont(String name) {
        try {
            if (resources.containsKey(name)) {
                Object obj = resources.get(name);
                if (!(obj instanceof Font)) {
                    throw new ChunkyException("Reference for " + name + " ended up with a bad value, " +
                            "suggested=" + Font.class.getName() + "; got=" + obj.getClass().getName());
                } else {
                    return (Font) obj;
                }
            } else {
                if (isSystemFont(name)) {
                    Font f = new Font(name, Font.PLAIN, 0);
                    resources.put(name, f);
                    return f;
                } else {
                    URL url = System.class.getResource("/assets/font/" + name + ".ttf");
                    if (url == null) {
                        throw new NullPointerException("Cannot find font " + name);
                    } else {
                        Font f = Font.createFont(Font.TRUETYPE_FONT, url.openStream());
                        resources.put(name, f);
                        return f;
                    }
                }
            }
        } catch (Exception ex) {
            throw new ChunkyException(ex);
        }
    }
View Full Code Here

public final class LogEventWriter implements Closeable, Flushable {
    private final Writer writer;

    public LogEventWriter(Writer writer) {
        if (writer == null) {
            throw new ChunkyException("Writer == null");
        }

        this.writer = writer;
    }
View Full Code Here

        this.writer = writer;
    }

    public void write(LogEvent event) throws IOException {
        if (event == null) {
            throw new ChunkyException("Event == null");
        } else {
            this.writer.write(event.toString());
        }
    }
View Full Code Here

        }
    }

    public void write(String comment) throws IOException {
        if (comment == null) {
            throw new ChunkyException("Comment == null");
        } else {
            this.writer.write((!comment.startsWith("#") ? "#" + comment : comment));
        }
    }
View Full Code Here

TOP

Related Classes of com.atlauncher.exceptions.ChunkyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.