Archive for September, 2012

Blog bookmarks 09/26/2012

September 26, 2012
  • “public class UnicodeReader extends Reader {
        private static final int BOM_SIZE = 4;
        private final InputStreamReader reader;

        /**
         * Construct UnicodeReader
         * @param in Input stream.
         * @param defaultEncoding Default encoding to be used if BOM is not found,
         * or null to use system default encoding.
         * @throws IOException If an I/O error occurs.
         */
        public UnicodeReader(InputStream in, String defaultEncoding) throws IOException {
            byte bom[] = new byte[BOM_SIZE];
            String encoding;
            int unread;
            PushbackInputStream pushbackStream = new PushbackInputStream(in, BOM_SIZE);
            int n = pushbackStream.read(bom, 0, bom.length);

            // Read ahead four bytes and check for BOM marks.
            if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
                encoding = “UTF-8”;
                unread = n – 3;
            } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
                encoding = “UTF-16BE”;
                unread = n – 2;
            } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
                encoding = “UTF-16LE”;
                unread = n – 2;
            } else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
                encoding = “UTF-32BE”;
                unread = n – 4;
            } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
                encoding = “UTF-32LE”;
                unread = n – 4;
            } else {
                encoding = defaultEncoding;
                unread = n;
            }

            // Unread bytes if necessary and skip BOM marks.
            if (unread > 0) {
                pushbackStream.unread(bom, (n – unread), unread);
            } else if (unread < -1) {
                pushbackStream.unread(bom, 0, 0);
            }

            // Use given encoding.
            if (encoding == null) {
                reader = new InputStreamReader(pushbackStream);
            } else {
                reader = new InputStreamReader(pushbackStream, encoding);
            }
        }

        public String getEncoding() {
            return reader.getEncoding();
        }

        public int read(char[] cbuf, int off, int len) throws IOException {
            return reader.read(cbuf, off, len);
        }

        public void close() throws IOException {
            reader.close();
        }
    }"

    tags: java mark bom

  • tags: time java date

Posted from Diigo. The rest of my favorite links are here.

Advertisements

Blog bookmarks 09/25/2012

September 25, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/20/2012

September 20, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/17/2012

September 17, 2012
  • tags: dojo

  • tags: dojo

  • tags: dojo

  • tags: dojo

  • tags: dojo

  • tags: dojo

    • Dojo is the Open Source JavaScript toolkit that helps you build serious applications in less time. – post by Ashish Bogawat
    • Dojo is the Open Source Javascript toolkit that makes professional web development better, easier, and faster. – post by Bin Li
    • Dojo is the Open Source Javascript toolkit that makes professional web development better, easier, and faster. – post by Bin Li
    • It is packed full of JavaScript goodness to help you create powerful web applications. – post by Nicolas Fournier
    • Browser toolkit – post by Jesper Kamstrup Linnet
    • Dojo is an Open Source toolkit that allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript. – post by john underwood
    • Dojo is an Open Source toolkit that allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript. – post by Olivier Ziller
    • Dojo is an Open Source effort by an invited set of contributors to create a UI toolkit that allows a larger number of web application authors to easily use the rich capabilities of modern browsers. – post by Kevin Wen
    • Dojo is the Open Source JavaScript toolkit that helps you build serious applications in less time. It fills in the gaps where JavaScript and browsers don’t go quite far enough, and gives you powerful, portable, lightweight, and tested tools for constructi – post by Jaroslaw Zabiello
    • dojo – post by Makoto
    • AJAX web developent toolkit for browsers. Cross browser JavaScriptlibrary (HTML, CSS, SVG, JavaScript) – post by Julian Knight
    • One of the respected Ajax code script libraries out there. – post by Lindsay Donaghe
    • Development kit for Ajax based dynamic capabilities into webpages, etc. Lego blocks for your own slice of Web2.0 – post by Andrew Dubber
    • AJAX toolkit. One of the better ones. – post by Justin Whitaker
    • Dojo is the Open Source JavaScript toolkit that helps you build serious applications in less time. It fills in the gaps where JavaScript and browsers don’t go quite far enough, and gives you powerful, portable, lightweight, and tested tools for constructi – post by Seth
    • AJAX javascript framework programming web2.0 opensource web tool – post by Rob Jongschaap
    • How does this compared to other ajax framework? – post by 59 Ideas
    • Dojo is the Open Source Javascript toolkit that makes professional web development better, easier, and faster – post by jdr santos
    • Dojo is Open Source software, distributed by a non-profit foundation which has been set up for the purpose of providing a vendor-neutral owner of Dojo intellectual property. – post by ken love
    • Ajax Library – post by Jun Ohwada

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/16/2012

September 16, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/11/2012

September 11, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/09/2012

September 9, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/08/2012

September 8, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/06/2012

September 6, 2012

Posted from Diigo. The rest of my favorite links are here.

Blog bookmarks 09/04/2012

September 4, 2012

Posted from Diigo. The rest of my favorite links are here.