Tuesday, March 10, 2015

IOException

java.io.IOException

IOException is described in the javadoc comments as:

Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations.
author: unascribed version: 1.22, 12/19/03 see: java.io.InputStream see: java.io.OutputStream since: JDK1.0

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer.printCDATAText(String)

protected void printCDATAText(String text) throws IOException {
    int length = text.length();
    char ch;
    for (int index = 0; index < length; ++index) {
        ch = text.charAt(index);
        if (ch == ']' && index + 2 < length && text.charAt(index + 1) == ']' && text.charAt(index + 2) == '>') {
            if (fDOMErrorHandler != null) {
                if ((features & DOMSerializerImpl.SPLITCDATA) == 0 && (features & DOMSerializerImpl.WELLFORMED) == 0) {
                    String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'EndingCDATA', null);
                    modifyDOMError(msg, DOMError.SEVERITY_FATAL_ERROR, fCurrentNode);
                    boolean continueProcess = fDOMErrorHandler.handleError(fDOMError);
                    if (!continueProcess) {
                        throw new IOException();
                    }
                } else {
                    String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'SplittingCDATA', null);
                    modifyDOMError(msg, DOMError.SEVERITY_WARNING, fCurrentNode);
                    fDOMErrorHandler.handleError(fDOMError);
                }
            }
            _printer.printText(']]]]><![CDATA[>');
            index += 2;
            continue;
        }
        if (!XMLChar.isValid(ch)) {
            if (++index < length) {
                surrogates(ch, text.charAt(index));
            } else {
                fatalError('The character '' + (char) ch + '' is an invalid XML character');
            }
            continue;
        } else {
            if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch) && ch != 0xF7) || ch == '\n' || ch == '\r' || ch == '\t') {
                _printer.printText((char) ch);
            } else {
                _printer.printText(']]>&#x');
                _printer.printText(Integer.toHexString(ch));
                _printer.printText(';<![CDATA[');
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serialize.XML11Serializer.printCDATAText(String)

protected final void printCDATAText(String text) throws IOException {
    int length = text.length();
    char ch;
    for (int index = 0; index < length; ++index) {
        ch = text.charAt(index);
        if (ch == ']' && index + 2 < length && text.charAt(index + 1) == ']' && text.charAt(index + 2) == '>') {
            if (fDOMErrorHandler != null) {
                if ((features & DOMSerializerImpl.SPLITCDATA) == 0 && (features & DOMSerializerImpl.WELLFORMED) == 0) {
                    String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'EndingCDATA', null);
                    modifyDOMError(msg, DOMError.SEVERITY_FATAL_ERROR, fCurrentNode);
                    boolean continueProcess = fDOMErrorHandler.handleError(fDOMError);
                    if (!continueProcess) {
                        throw new IOException();
                    }
                } else {
                    String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'SplittingCDATA', null);
                    modifyDOMError(msg, DOMError.SEVERITY_WARNING, fCurrentNode);
                    fDOMErrorHandler.handleError(fDOMError);
                }
            }
            _printer.printText(']]]]><![CDATA[>');
            index += 2;
            continue;
        }
        if (!XML11Char.isXML11Valid(ch)) {
            if (++index < length) {
                surrogates(ch, text.charAt(index));
            } else {
                fatalError('The character '' + (char) ch + '' is an invalid XML character');
            }
            continue;
        } else {
            if (_encodingInfo.isPrintable((char) ch) && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText((char) ch);
            } else {
                _printer.printText(']]>&#x');
                _printer.printText(Integer.toHexString(ch));
                _printer.printText(';<![CDATA[');
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.FileInputStream.getFD()

/**
     * Returns the <code>FileDescriptor</code>
     * object  that represents the connection to
     * the actual file in the file system being
     * used by this <code>FileInputStream</code>.
     * @return     the file descriptor object associated with this stream.
     * @exception  IOException  if an I/O error occurs.
     * @see        java.io.FileDescriptor
     */
public final FileDescriptor getFD() throws IOException {
    if (fd != null) return fd;
    throw new IOException();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.FileOutputStream.getFD()

/**
     * Returns the file descriptor associated with this stream.
     * @return  the <code>FileDescriptor</code> object that represents 
     *          the connection to the file in the file system being used 
     *          by this <code>FileOutputStream</code> object. 
     * @exception  IOException  if an I/O error occurs.
     * @see        java.io.FileDescriptor
     */
public final FileDescriptor getFD() throws IOException {
    if (fd != null) return fd;
    throw new IOException();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PrintStream.setError()

/**
     * Set the error state of the stream to <code>true</code>.
     * @since JDK1.1
     */
protected void setError() {
    trouble = true;
    try {
        throw new IOException();
    } catch (IOException x) {
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PrintWriter.setError()

/** Indicate that an error has occurred. */
protected void setError() {
    trouble = true;
    try {
        throw new IOException();
    } catch (IOException x) {
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.RandomAccessFile.getFD()

/**
     * Returns the opaque file descriptor object associated with this
     * stream. 
     * @return     the file descriptor object associated with this stream.
     * @exception  IOException  if an I/O error occurs.
     * @see        java.io.FileDescriptor
     */
public final FileDescriptor getFD() throws IOException {
    if (fd != null) return fd;
    throw new IOException();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.RepositoryId_1_3.useFullValueDescription(Class, String)

/**
     * Checks to see if the FullValueDescription should be retrieved.
     * @exception Throws IOException if suids do not match or if the repositoryID
     * is not an RMIValueType
     */
public static boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException {
    String clazzRepIDStr = createForAnyType(clazz);
    if (clazzRepIDStr.equals(repositoryID)) return false;
    RepositoryId_1_3 targetRepid;
    RepositoryId_1_3 clazzRepid;
    synchronized (cache) {
        targetRepid = cache.getId(repositoryID);
        clazzRepid = cache.getId(clazzRepIDStr);
    }
    if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())) {
        if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
            String mssg = 'Mismatched serialization UIDs : Source (Rep. ID' + clazzRepid + ') = ' + clazzRepid.getSerialVersionUID() + ' whereas Target (Rep. ID ' + repositoryID + ') = ' + targetRepid.getSerialVersionUID();
            throw new IOException(mssg);
        } else {
            return true;
        }
    } else {
        throw new IOException('The repository ID is not of an RMI value type (Expected ID = ' + clazzRepIDStr + '; Received ID = ' + repositoryID + ')');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.RepositoryId_1_3_1.useFullValueDescription(Class, String)

/**
     * Checks to see if the FullValueDescription should be retrieved.
     * @exception Throws IOException if suids do not match or if the repositoryID
     * is not an RMIValueType
     */
public static boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException {
    String clazzRepIDStr = createForAnyType(clazz);
    if (clazzRepIDStr.equals(repositoryID)) return false;
    RepositoryId_1_3_1 targetRepid;
    RepositoryId_1_3_1 clazzRepid;
    synchronized (cache) {
        targetRepid = cache.getId(repositoryID);
        clazzRepid = cache.getId(clazzRepIDStr);
    }
    if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())) {
        if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
            String mssg = 'Mismatched serialization UIDs : Source (Rep. ID' + clazzRepid + ') = ' + clazzRepid.getSerialVersionUID() + ' whereas Target (Rep. ID ' + repositoryID + ') = ' + targetRepid.getSerialVersionUID();
            throw new IOException(mssg);
        } else {
            return true;
        }
    } else {
        throw new IOException('The repository ID is not of an RMI value type (Expected ID = ' + clazzRepIDStr + '; Received ID = ' + repositoryID + ')');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.util.RepositoryId.useFullValueDescription(Class, String)

/**
     * Checks to see if the FullValueDescription should be retrieved.
     * @exception Throws IOException if suids do not match or if the repositoryID
     * is not an RMIValueType
     */
public static boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException {
    String clazzRepIDStr = createForAnyType(clazz);
    if (clazzRepIDStr.equals(repositoryID)) return false;
    RepositoryId targetRepid;
    RepositoryId clazzRepid;
    synchronized (cache) {
        targetRepid = cache.getId(repositoryID);
        clazzRepid = cache.getId(clazzRepIDStr);
    }
    if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())) {
        if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
            String mssg = 'Mismatched serialization UIDs : Source (Rep. ID' + clazzRepid + ') = ' + clazzRepid.getSerialVersionUID() + ' whereas Target (Rep. ID ' + repositoryID + ') = ' + targetRepid.getSerialVersionUID();
            throw new IOException(mssg);
        } else {
            return true;
        }
    } else {
        throw new IOException('The repository ID is not of an RMI value type (Expected ID = ' + clazzRepIDStr + '; Received ID = ' + repositoryID + ')');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer.fatalError(String)

protected void fatalError(String message) throws IOException {
    if (fDOMErrorHandler != null) {
        modifyDOMError(message, DOMError.SEVERITY_FATAL_ERROR, fCurrentNode);
        fDOMErrorHandler.handleError(fDOMError);
    } else {
        throw new IOException(message);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer.prepare()

protected void prepare() throws IOException {
    if (_prepared) return;
    if (_writer == null && _output == null) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoWriterSupplied', null);
        throw new IOException(msg);
    }
    _encodingInfo = _format.getEncodingInfo();
    if (_output != null) {
        _writer = _encodingInfo.getWriter(_output);
    }
    if (_format.getIndenting()) {
        _indenting = true;
        _printer = new IndentPrinter(_writer, _format);
    } else {
        _indenting = false;
        _printer = new Printer(_writer, _format);
    }
    ElementState state;
    _elementStateCount = 0;
    state = _elementStates[0];
    state.namespaceURI = null;
    state.localName = null;
    state.rawName = null;
    state.preserveSpace = _format.getPreserveSpace();
    state.empty = true;
    state.afterElement = false;
    state.afterComment = false;
    state.doCData = state.inCData = false;
    state.prefixes = null;
    _docTypePublicId = _format.getDoctypePublic();
    _docTypeSystemId = _format.getDoctypeSystem();
    _started = false;
    _prepared = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serializer.ToStream.accumDefaultEscape(Writer, char, int, char[], int, boolean, boolean)

/**
     * Escape and writer.write a character.
     * @param ch character to be escaped.
     * @param i index into character array.
     * @param chars non-null reference to character array.
     * @param len length of chars.
     * @param fromTextNode true if the characters being processed are
     * from a text node, false if the characters being processed are from
     * an attribute value.
     * @param escLF true if the linefeed should be escaped.
     * @return i+1 if a character was written, i+2 if two characters
     * were written out, else return i.
     * @throws org.xml.sax.SAXException
     */
protected int accumDefaultEscape(Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException {
    int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF);
    if (i == pos) {
        if (0xd800 <= ch && ch < 0xdc00) {
            int next;
            if (i + 1 >= len) {
                throw new IOException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch) }));
            } else {
                next = chars[++i];
                if (!(0xdc00 <= next && next < 0xe000)) throw new IOException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch) + ' ' + Integer.toHexString(next) }));
                next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
            }
            writer.write('&#');
            writer.write(Integer.toString(next));
            writer.write(';');
            pos += 2;
        } else {
            if (!escapingNotNeeded(ch) || ((fromTextNode && m_charInfo.isSpecialTextChar(ch)) || (!fromTextNode && m_charInfo.isSpecialAttrChar(ch)))) {
                writer.write('&#');
                writer.write(Integer.toString(ch));
                writer.write(';');
            } else {
                writer.write(ch);
            }
            pos++;
        }
    }
    return pos;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serializer.ToStream.getURF16SurrogateValue(char, char, int, int)

/**
     * Once a surrogate has been detected, get the pair as a single integer
     * value.
     * @param c the first part of the surrogate.
     * @param ch Character array.
     * @param i position Where the surrogate was detected.
     * @param end The end index of the significant characters.
     * @return the integer value of the UTF-16 surrogate.
     * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
     */
int getURF16SurrogateValue(char c, char ch[], int i, int end) throws IOException {
    int next;
    if (i + 1 >= end) {
        throw new IOException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString((int) c) }));
    } else {
        next = ch[++i];
        if (!(0xdc00 <= next && next < 0xe000)) throw new IOException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString((int) c) + ' ' + Integer.toHexString(next) }));
        next = ((c - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
    }
    return next;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.login.ConfigFile.expand(String)

private String expand(String value) throws PropertyExpander.ExpandException, IOException {
    if (''.equals(value)) {
        return value;
    }
    if (expandProp) {
        String s = PropertyExpander.expand(value);
        if (s == null || s.length() == 0) {
            MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: ' + 'system property [value] expanded to empty value', 'sun.security.util.AuthResources'));
            Object[] source = { new Integer(linenum), value };
            throw new IOException(form.format(source));
        }
        return s;
    } else {
        return value;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.login.ConfigFile.init()

/**
     * Read and initialize the entire login Configuration.
     * 
     * @exception IOException if the Configuration can not be initialized. 
     * @exception SecurityException if the caller does not have permission
     *    to initialize the Configuration.
     */
private void init() throws IOException {
    boolean initialized = false;
    FileReader fr = null;
    String sep = File.separator;
    HashMap newConfig = new HashMap();
    String allowSys = java.security.Security.getProperty('policy.allowSystemProperty');
    if ('true'.equalsIgnoreCase(allowSys)) {
        String extra_config = System.getProperty('java.security.auth.login.config');
        if (extra_config != null) {
            boolean overrideAll = false;
            if (extra_config.startsWith('=')) {
                overrideAll = true;
                extra_config = extra_config.substring(1);
            }
            try {
                extra_config = PropertyExpander.expand(extra_config);
            } catch (PropertyExpander.ExpandException peee) {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Unable to properly expand config', 'sun.security.util.AuthResources'));
                Object[] source = { extra_config };
                throw new IOException(form.format(source));
            }
            URL configURL = null;
            try {
                configURL = new URL(extra_config);
            } catch (java.net.MalformedURLException mue) {
                File configFile = new File(extra_config);
                if (configFile.exists()) {
                    configURL = new URL('file:' + configFile.getCanonicalPath());
                } else {
                    MessageFormat form = new MessageFormat(ResourcesMgr.getString('extra_config (No such file or directory)', 'sun.security.util.AuthResources'));
                    Object[] source = { extra_config };
                    throw new IOException(form.format(source));
                }
            }
            if (testing) System.out.println('reading ' + configURL);
            init(configURL, newConfig);
            initialized = true;
            if (overrideAll) {
                if (testing) System.out.println('overriding other policies!');
            }
        }
    }
    int n = 1;
    String config_url;
    while ((config_url = java.security.Security.getProperty('login.config.url.' + n)) != null) {
        try {
            config_url = PropertyExpander.expand(config_url).replace(File.separatorChar, '/');
            if (testing) System.out.println('\tReading config: ' + config_url);
            init(new URL(config_url), newConfig);
            initialized = true;
        } catch (PropertyExpander.ExpandException peee) {
            MessageFormat form = new MessageFormat(ResourcesMgr.getString('Unable to properly expand config', 'sun.security.util.AuthResources'));
            Object[] source = { config_url };
            throw new IOException(form.format(source));
        }
        n++;
    }
    if (initialized == false && n == 1 && config_url == null) {
        if (testing) System.out.println('\tReading Policy ' + 'from ~/.java.login.config');
        config_url = System.getProperty('user.home');
        try {
            init(new URL('file:' + config_url + File.separatorChar + '.java.login.config'), newConfig);
        } catch (IOException ioe) {
            throw new IOException(ResourcesMgr.getString('Unable to locate a login configuration', 'sun.security.util.AuthResources'));
        }
    }
    configuration = newConfig;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.login.ConfigFile.match(String)

private String match(String expect) throws IOException {
    String value = null;
    switch(lookahead) {
        case StreamTokenizer.TT_EOF:
            MessageFormat form1 = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\texpected [expect], ' + 'read [end of file]', 'sun.security.util.AuthResources'));
            Object[] source1 = { expect };
            throw new IOException(form1.format(source1));
        case ''':
        case StreamTokenizer.TT_WORD:
            if (expect.equalsIgnoreCase('module class name') || expect.equalsIgnoreCase('controlFlag') || expect.equalsIgnoreCase('option key') || expect.equalsIgnoreCase('option value')) {
                value = st.sval;
                lookahead = nextToken();
            } else {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: ' + 'expected [expect], found [value]', 'sun.security.util.AuthResources'));
                Object[] source = { new Integer(linenum), expect, st.sval };
                throw new IOException(form.format(source));
            }
            break;
        case '{':
            if (expect.equalsIgnoreCase('{')) {
                lookahead = nextToken();
            } else {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: expected [expect]', 'sun.security.util.AuthResources'));
                Object[] source = { new Integer(linenum), expect, st.sval };
                throw new IOException(form.format(source));
            }
            break;
        case ';':
            if (expect.equalsIgnoreCase(';')) {
                lookahead = nextToken();
            } else {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: expected [expect]', 'sun.security.util.AuthResources'));
                Object[] source = { new Integer(linenum), expect, st.sval };
                throw new IOException(form.format(source));
            }
            break;
        case '}':
            if (expect.equalsIgnoreCase('}')) {
                lookahead = nextToken();
            } else {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: expected [expect]', 'sun.security.util.AuthResources'));
                Object[] source = { new Integer(linenum), expect, st.sval };
                throw new IOException(form.format(source));
            }
            break;
        case '=':
            if (expect.equalsIgnoreCase('=')) {
                lookahead = nextToken();
            } else {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: expected [expect]', 'sun.security.util.AuthResources'));
                Object[] source = { new Integer(linenum), expect, st.sval };
                throw new IOException(form.format(source));
            }
            break;
        default:
            MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tLine line: ' + 'expected [expect], found [value]', 'sun.security.util.AuthResources'));
            Object[] source = { new Integer(linenum), expect, st.sval };
            throw new IOException(form.format(source));
    }
    return value;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.security.auth.login.ConfigFile.parseLoginEntry(HashMap)

private void parseLoginEntry(HashMap newConfig) throws IOException {
    String appName;
    String moduleClass;
    String sflag;
    AppConfigurationEntry.LoginModuleControlFlag controlFlag;
    LinkedList configEntries = new LinkedList();
    appName = st.sval;
    lookahead = nextToken();
    if (testing) System.out.println('appName = ' + appName);
    match('{');
    while (peek('}') == false) {
        HashSet argSet = new HashSet();
        moduleClass = match('module class name');
        sflag = match('controlFlag');
        if (sflag.equalsIgnoreCase('REQUIRED')) controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; else if (sflag.equalsIgnoreCase('REQUISITE')) controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE; else if (sflag.equalsIgnoreCase('SUFFICIENT')) controlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT; else if (sflag.equalsIgnoreCase('OPTIONAL')) controlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL; else {
            MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\tInvalid control flag, flag', 'sun.security.util.AuthResources'));
            Object[] source = { sflag };
            throw new IOException(form.format(source));
        }
        HashMap options = new HashMap();
        String key;
        String value;
        while (peek(';') == false) {
            key = match('option key');
            match('=');
            try {
                value = expand(match('option value'));
            } catch (PropertyExpander.ExpandException peee) {
                throw new IOException(peee.getLocalizedMessage());
            }
            options.put(key, value);
        }
        lookahead = nextToken();
        if (testing) {
            System.out.print('\t\t' + moduleClass + ', ' + sflag);
            java.util.Iterator i = options.keySet().iterator();
            while (i.hasNext()) {
                key = (String) i.next();
                System.out.print(', ' + key + '=' + (String) options.get(key));
            }
            System.out.println('');
        }
        AppConfigurationEntry entry = new AppConfigurationEntry(moduleClass, controlFlag, options);
        configEntries.add(entry);
    }
    match('}');
    match(';');
    if (newConfig.containsKey(appName)) {
        MessageFormat form = new MessageFormat(ResourcesMgr.getString('Configuration Error:\n\t' + 'Can not specify multiple entries for appName', 'sun.security.util.AuthResources'));
        Object[] source = { appName };
        throw new IOException(form.format(source));
    }
    newConfig.put(appName, configEntries);
    if (testing) System.out.println('\t\t***Added entry for ' + appName + ' to overall configuration***');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.datatransfer.MimeType.readExternal(ObjectInput)

/**
     * The object implements the readExternal method to restore its
     * contents by calling the methods of DataInput for primitive
     * types and readObject for objects, strings and arrays.  The
     * readExternal method must read the values in the same sequence
     * and with the same types as were written by writeExternal.
     * @exception ClassNotFoundException If the class for an object being
     *              restored cannot be found.
     */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    String s = in.readUTF();
    if (s == null || s.length() == 0) {
        byte[] ba = new byte[in.readInt()];
        in.readFully(ba);
        s = new String(ba);
    }
    try {
        parse(s);
    } catch (MimeTypeParseException e) {
        throw new IOException(e.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.CodeSource.readObject(java.io.ObjectInputStream)

/**
     * Restores this object from a stream (i.e., deserializes it).
     */
private synchronized void readObject(java.io.ObjectInputStream ois) throws IOException, ClassNotFoundException {
    CertificateFactory cf;
    Hashtable cfs = null;
    ois.defaultReadObject();
    int size = ois.readInt();
    if (size > 0) {
        cfs = new Hashtable(3);
        this.certs = new java.security.cert.Certificate[size];
    }
    for (int i = 0; i < size; i++) {
        String certType = ois.readUTF();
        if (cfs.containsKey(certType)) {
            cf = (CertificateFactory) cfs.get(certType);
        } else {
            try {
                cf = CertificateFactory.getInstance(certType);
            } catch (CertificateException ce) {
                throw new ClassNotFoundException('Certificate factory for ' + certType + ' not found');
            }
            cfs.put(certType, cf);
        }
        byte[] encoded = null;
        try {
            encoded = new byte[ois.readInt()];
        } catch (OutOfMemoryError oome) {
            throw new IOException('Certificate too big');
        }
        ois.readFully(encoded);
        ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
        try {
            this.certs[i] = cf.generateCertificate(bais);
        } catch (CertificateException ce) {
            throw new IOException(ce.getMessage());
        }
        bais.close();
    }
    try {
        this.signers = (CodeSigner[]) ois.readObject();
    } catch (IOException ioe) {
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.CodeSource.writeObject(java.io.ObjectOutputStream)

/**
     * Writes this object out to a stream (i.e., serializes it).
     * @serialData An initial <code>URL</code> is followed by an
     * <code>int</code> indicating the number of certificates to follow 
     * (a value of 'zero' denotes that there are no certificates associated
     * with this object).
     * Each certificate is written out starting with a <code>String</code>
     * denoting the certificate type, followed by an
     * <code>int</code> specifying the length of the certificate encoding,
     * followed by the certificate encoding itself which is written out as an
     * array of bytes. Finally, if any code signers are present then the array 
     * of code signers is serialized and written out too.
     */
private synchronized void writeObject(java.io.ObjectOutputStream oos) throws IOException {
    oos.defaultWriteObject();
    if (certs == null || certs.length == 0) {
        oos.writeInt(0);
    } else {
        oos.writeInt(certs.length);
        for (int i = 0; i < certs.length; i++) {
            java.security.cert.Certificate cert = certs[i];
            try {
                oos.writeUTF(cert.getType());
                byte[] encoded = cert.getEncoded();
                oos.writeInt(encoded.length);
                oos.write(encoded);
            } catch (CertificateEncodingException cee) {
                throw new IOException(cee.getMessage());
            }
        }
    }
    if (signers != null && signers.length > 0) {
        oos.writeObject(signers);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.UnresolvedPermission.readObject(java.io.ObjectInputStream)

/**
     * Restores this object from a stream (i.e., deserializes it).
     */
private synchronized void readObject(java.io.ObjectInputStream ois) throws IOException, ClassNotFoundException {
    CertificateFactory cf;
    Hashtable cfs = null;
    ois.defaultReadObject();
    if (type == null) throw new NullPointerException('type can't be null');
    int size = ois.readInt();
    if (size > 0) {
        cfs = new Hashtable(3);
        this.certs = new java.security.cert.Certificate[size];
    }
    for (int i = 0; i < size; i++) {
        String certType = ois.readUTF();
        if (cfs.containsKey(certType)) {
            cf = (CertificateFactory) cfs.get(certType);
        } else {
            try {
                cf = CertificateFactory.getInstance(certType);
            } catch (CertificateException ce) {
                throw new ClassNotFoundException('Certificate factory for ' + certType + ' not found');
            }
            cfs.put(certType, cf);
        }
        byte[] encoded = null;
        try {
            encoded = new byte[ois.readInt()];
        } catch (OutOfMemoryError oome) {
            throw new IOException('Certificate too big');
        }
        ois.readFully(encoded);
        ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
        try {
            this.certs[i] = cf.generateCertificate(bais);
        } catch (CertificateException ce) {
            throw new IOException(ce.getMessage());
        }
        bais.close();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.UnresolvedPermission.writeObject(java.io.ObjectOutputStream)

/**
     * Writes this object out to a stream (i.e., serializes it).
     * @serialData An initial <code>String</code> denoting the
     * <code>type</code> is followed by a <code>String</code> denoting the
     * <code>name</code> is followed by a <code>String</code> denoting the
     * <code>actions</code> is followed by an <code>int</code> indicating the
     * number of certificates to follow 
     * (a value of 'zero' denotes that there are no certificates associated
     * with this object).
     * Each certificate is written out starting with a <code>String</code>
     * denoting the certificate type, followed by an
     * <code>int</code> specifying the length of the certificate encoding,
     * followed by the certificate encoding itself which is written out as an
     * array of bytes.
     */
private synchronized void writeObject(java.io.ObjectOutputStream oos) throws IOException {
    oos.defaultWriteObject();
    if (certs == null || certs.length == 0) {
        oos.writeInt(0);
    } else {
        oos.writeInt(certs.length);
        for (int i = 0; i < certs.length; i++) {
            java.security.cert.Certificate cert = certs[i];
            try {
                oos.writeUTF(cert.getType());
                byte[] encoded = cert.getEncoded();
                oos.writeInt(encoded.length);
                oos.write(encoded);
            } catch (CertificateEncodingException cee) {
                throw new IOException(cee.getMessage());
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.cert.X509CertSelector.getExtensionObject(X509Certificate, int)

/**
     * Returns an Extension object given any X509Certificate and extension oid.
     * Throw an <code>IOException</code> if the extension byte value is 
     * malformed.
     * @param cert a <code>X509Certificate</code> 
     * @param extId an <code>integer</code> which specifies the extension index. 
     * Currently, the supported extensions are as follows:
     * index 0 - PrivateKeyUsageExtension
     * index 1 - SubjectAlternativeNameExtension
     * index 2 - NameConstraintsExtension   
     * index 3 - CertificatePoliciesExtension
     * index 4 - ExtendedKeyUsageExtension
     * @return an <code>Extension</code> object whose real type is as specified
     * by the extension oid.
     * @throws IOException if cannot construct the <code>Extension</code> 
     * object with the extension encoding retrieved from the passed in 
     * <code>X509Certificate</code>.
     */
private static Extension getExtensionObject(X509Certificate cert, int extId) throws IOException {
    if (cert instanceof X509CertImpl) {
        X509CertImpl impl = (X509CertImpl) cert;
        switch(extId) {
            case PRIVATE_KEY_USAGE_ID:
                return impl.getPrivateKeyUsageExtension();
            case SUBJECT_ALT_NAME_ID:
                return impl.getSubjectAlternativeNameExtension();
            case NAME_CONSTRAINTS_ID:
                return impl.getNameConstraintsExtension();
            case CERT_POLICIES_ID:
                return impl.getCertificatePoliciesExtension();
            case EXTENDED_KEY_USAGE_ID:
                return impl.getExtendedKeyUsageExtension();
            default:
                return null;
        }
    }
    byte[] rawExtVal = cert.getExtensionValue(EXTENSION_OIDS[extId]);
    if (rawExtVal == null) {
        return null;
    }
    DerInputStream in = new DerInputStream(rawExtVal);
    byte[] encoded = in.getOctetString();
    switch(extId) {
        case PRIVATE_KEY_USAGE_ID:
            try {
                return new PrivateKeyUsageExtension(FALSE, encoded);
            } catch (CertificateException ex) {
                throw new IOException(ex.getMessage());
            }
        case SUBJECT_ALT_NAME_ID:
            return new SubjectAlternativeNameExtension(FALSE, encoded);
        case NAME_CONSTRAINTS_ID:
            return new NameConstraintsExtension(FALSE, encoded);
        case CERT_POLICIES_ID:
            return new CertificatePoliciesExtension(FALSE, encoded);
        case EXTENDED_KEY_USAGE_ID:
            return new ExtendedKeyUsageExtension(FALSE, encoded);
        default:
            return null;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.loading.MLetParser.parse(URL)

/**
     * Scan an html file for <mlet> tags
     */
public Vector parse(URL url) throws IOException {
    String mth = 'parse';
    String requiresNameWarning = '<param name=... value=...> tag requires name parameter.';
    String paramOutsideWarning = '<param> tag outside <mlet> ... </mlet>.';
    String requiresCodeWarning = '<mlet> tag requires either code or object parameter.';
    String requiresJarsWarning = '<mlet> tag requires archive parameter.';
    URLConnection conn;
    conn = url.openConnection();
    Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), 'UTF-8'));
    url = conn.getURL();
    Vector mlets = new Vector();
    Hashtable atts = null;
    Vector types = new Vector();
    Vector values = new Vector();
    while (true) {
        c = in.read();
        if (c == -1) break;
        if (c == '<') {
            c = in.read();
            if (c == '/') {
                c = in.read();
                String nm = scanIdentifier(in);
                if (nm.equalsIgnoreCase(tag)) {
                    if (atts != null) {
                        if ((types.size() == values.size()) && ((!types.isEmpty()) && (!values.isEmpty()))) {
                            atts.put('types', types.clone());
                            atts.put('values', values.clone());
                        }
                        mlets.addElement(new MLetContent(url, atts));
                    }
                    atts = null;
                    types.removeAllElements();
                    values.removeAllElements();
                }
            } else {
                String nm = scanIdentifier(in);
                if (nm.equalsIgnoreCase('arg')) {
                    Hashtable t = scanTag(in);
                    String att = (String) t.get('type');
                    if (att == null) {
                        if (isTraceOn()) {
                            trace(mth, requiresNameWarning);
                        }
                        throw new IOException(requiresNameWarning);
                    } else {
                        if (atts != null) {
                            types.addElement(att);
                        } else {
                            if (isTraceOn()) {
                                trace(mth, paramOutsideWarning);
                            }
                            throw new IOException(paramOutsideWarning);
                        }
                    }
                    String val = (String) t.get('value');
                    if (val == null) {
                        if (isTraceOn()) {
                            trace(mth, requiresNameWarning);
                        }
                        throw new IOException(requiresNameWarning);
                    } else {
                        if (atts != null) {
                            values.addElement(val);
                        } else {
                            if (isTraceOn()) {
                                trace(mth, paramOutsideWarning);
                            }
                            throw new IOException(paramOutsideWarning);
                        }
                    }
                } else {
                    if (nm.equalsIgnoreCase(tag)) {
                        atts = scanTag(in);
                        if (atts.get('code') == null && atts.get('object') == null) {
                            if (isTraceOn()) {
                                trace(mth, requiresCodeWarning);
                            }
                            atts = null;
                            throw new IOException(requiresCodeWarning);
                        }
                        if (atts.get('archive') == null) {
                            if (isTraceOn()) {
                                trace(mth, requiresJarsWarning);
                            }
                            atts = null;
                            throw new IOException(requiresJarsWarning);
                        }
                    }
                }
            }
        }
    }
    in.close();
    return mlets;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.kerberos.KeyImpl.readObject(ObjectInputStream)

private synchronized void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    try {
        EncryptionKey encKey = new EncryptionKey(new DerValue((byte[]) ois.readObject()));
        keyType = encKey.getEType();
        keyBytes = encKey.getBytes();
    } catch (Asn1Exception ae) {
        throw new IOException(ae.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.kerberos.KeyImpl.writeObject(ObjectOutputStream)

/**
    * @serialData this <code>KeyImpl</code> is serialized by
    *   writing out the ASN1 Encoded bytes of the
    *   encryption key. The ASN1 encoding is defined in 
    *   RFC1510 and as  follows:
    *   EncryptionKey ::=   SEQUENCE {
    *    keytype[0]    INTEGER,
    *    keyvalue[1]   OCTET STRING     
    *    }
    **/
private synchronized void writeObject(ObjectOutputStream ois) throws IOException {
    if (destroyed) {
        throw new IOException('This key is no longer valid');
    }
    try {
        ois.writeObject((new EncryptionKey(keyType, keyBytes)).asn1Encode());
    } catch (Asn1Exception ae) {
        throw new IOException(ae.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JComponent.readObject(ObjectInputStream)

/**
     * We use the <code>ObjectInputStream</code> 'registerValidation'
     * callback to update the UI for the entire tree of components
     * after they've all been read in.
     * @param s  the <code>ObjectInputStream</code> from which to read
     */
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    ReadObjectCallback cb = (ReadObjectCallback) (readObjectCallbacks.get(s));
    if (cb == null) {
        try {
            readObjectCallbacks.put(s, cb = new ReadObjectCallback(s));
        } catch (Exception e) {
            throw new IOException(e.toString());
        }
    }
    cb.registerComponent(this);
    if (getToolTipText() != null) {
        ToolTipManager.sharedInstance().registerComponent(this);
    }
    int cpCount = s.readInt();
    if (cpCount > 0) {
        clientProperties = new ArrayTable();
        for (int counter = 0; counter < cpCount; counter++) {
            clientProperties.put(s.readObject(), s.readObject());
        }
    }
    setWriteObjCounter(this, (byte) 0);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JEditorPane.read(InputStream, Document)

/**
     * This method invokes the <code>EditorKit</code> to initiate a
     * read.  In the case where a <code>ChangedCharSetException</code>
     * is thrown this exception will contain the new CharSet.
     * Therefore the <code>read</code> operation
     * is then restarted after building a new Reader with the new charset.
     * @param in the inputstream to use
     * @param doc the document to load
     */
void read(InputStream in, Document doc) throws IOException {
    try {
        String charset = (String) getClientProperty('charset');
        Reader r = (charset != null) ? new InputStreamReader(in, charset) : new InputStreamReader(in);
        kit.read(r, doc, 0);
    } catch (BadLocationException e) {
        throw new IOException(e.getMessage());
    } catch (ChangedCharSetException e1) {
        String charSetSpec = e1.getCharSetSpec();
        if (e1.keyEqualsCharSet()) {
            putClientProperty('charset', charSetSpec);
        } else {
            setCharsetFromContentTypeParameters(charSetSpec);
        }
        in.close();
        URL url = (URL) doc.getProperty(Document.StreamDescriptionProperty);
        URLConnection conn = url.openConnection();
        in = conn.getInputStream();
        try {
            doc.remove(0, doc.getLength());
        } catch (BadLocationException e) {
        }
        doc.putProperty('IgnoreCharsetDirective', Boolean.valueOf(true));
        read(in, doc);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.JTextComponent.read(Reader, Object)

/**
     * Initializes from a stream.  This creates a
     * model of the type appropriate for the component
     * and initializes the model from the stream.
     * By default this will load the model as plain
     * text.  Previous contents of the model are discarded.
     * @param in the stream to read from
     * @param desc an object describing the stream; this
     *   might be a string, a File, a URL, etc.  Some kinds
     *   of documents (such as html for example) might be
     *   able to make use of this information; if non-<code>null</code>,
     *   it is added as a property of the document
     * @exception IOException as thrown by the stream being
     *  used to initialize
     * @see EditorKit#createDefaultDocument
     * @see #setDocument
     * @see PlainDocument
     */
public void read(Reader in, Object desc) throws IOException {
    EditorKit kit = getUI().getEditorKit(this);
    Document doc = kit.createDefaultDocument();
    if (desc != null) {
        doc.putProperty(Document.StreamDescriptionProperty, desc);
    }
    try {
        kit.read(in, doc, 0);
        setDocument(doc);
    } catch (BadLocationException e) {
        throw new IOException(e.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.JTextComponent.write(Writer)

/**
     * Stores the contents of the model into the given
     * stream.  By default this will store the model as plain
     * text.
     * @param out the output stream
     * @exception IOException on any I/O error
     */
public void write(Writer out) throws IOException {
    Document doc = getDocument();
    try {
        getUI().getEditorKit(this).write(out, doc, 0, doc.getLength());
    } catch (BadLocationException e) {
        throw new IOException(e.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.xinclude.XIncludeTextReader.getReader(XMLInputSource)

/**
     * Return the Reader for given XMLInputSource.
     * @param source The XMLInputSource to use.
     */
protected Reader getReader(XMLInputSource source) throws IOException {
    if (source.getCharacterStream() != null) {
        return source.getCharacterStream();
    } else {
        InputStream stream = null;
        String encoding = source.getEncoding();
        if (encoding == null) {
            encoding = 'UTF-8';
        }
        if (source.getByteStream() != null) {
            stream = source.getByteStream();
            if (!(stream instanceof BufferedInputStream)) {
                stream = new BufferedInputStream(stream);
            }
        } else {
            String expandedSystemId = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), false);
            URL url = new URL(expandedSystemId);
            URLConnection urlCon = url.openConnection();
            if (urlCon instanceof HttpURLConnection) {
                if (fAccept != null && fAccept.length() > 0) {
                    urlCon.setRequestProperty(XIncludeHandler.HTTP_ACCEPT, fAccept);
                }
                if (fAcceptLanguage != null && fAcceptLanguage.length() > 0) {
                    urlCon.setRequestProperty(XIncludeHandler.HTTP_ACCEPT_LANGUAGE, fAcceptLanguage);
                }
            }
            stream = new BufferedInputStream(urlCon.getInputStream());
            String rawContentType = urlCon.getContentType();
            int index = (rawContentType != null) ? rawContentType.indexOf(';') : -1;
            String contentType = null;
            String charset = null;
            if (index != -1) {
                contentType = rawContentType.substring(0, index).trim();
                charset = rawContentType.substring(index + 1).trim();
                if (charset.startsWith('charset=')) {
                    charset = charset.substring(8).trim();
                    if ((charset.charAt(0) == ''' && charset.charAt(charset.length() - 1) == ''') || (charset.charAt(0) == '\'' && charset.charAt(charset.length() - 1) == '\'')) {
                        charset = charset.substring(1, charset.length() - 1);
                    }
                } else {
                    charset = null;
                }
            } else {
                contentType = rawContentType.trim();
            }
            String detectedEncoding = null;
            if (contentType.equals('text/xml')) {
                if (charset != null) {
                    detectedEncoding = charset;
                } else {
                    detectedEncoding = 'US-ASCII';
                }
            } else if (contentType.equals('application/xml')) {
                if (charset != null) {
                    detectedEncoding = charset;
                } else {
                    detectedEncoding = getEncodingName(stream);
                }
            } else if (contentType.endsWith('+xml')) {
                detectedEncoding = getEncodingName(stream);
            }
            if (detectedEncoding != null) {
                encoding = detectedEncoding;
            }
        }
        encoding = encoding.toUpperCase(Locale.ENGLISH);
        consumeBOM(stream, encoding);
        if (encoding.equals('UTF-8')) {
            return new UTF8Reader(stream, XMLEntityManager.DEFAULT_BUFFER_SIZE, fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN), fErrorReporter.getLocale());
        }
        String javaEncoding = EncodingMap.getIANA2JavaMapping(encoding);
        if (javaEncoding == null) {
            MessageFormatter aFormatter = fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN);
            Locale aLocale = fErrorReporter.getLocale();
            throw new IOException(aFormatter.formatMessage(aLocale, 'EncodingDeclInvalid', new Object[] { encoding }));
        } else if (javaEncoding.equals('ASCII')) {
            return new ASCIIReader(stream, XMLEntityManager.DEFAULT_BUFFER_SIZE, fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN), fErrorReporter.getLocale());
        }
        return new InputStreamReader(stream, javaEncoding);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedReader.reset()

/**
     * Reset the stream to the most recent mark.
     * @exception  IOException  If the stream has never been marked,
     *                          or if the mark has been invalidated
     */
public void reset() throws IOException {
    synchronized (lock) {
        ensureOpen();
        if (markedChar < 0) throw new IOException((markedChar == INVALIDATED) ? 'Mark invalid' : 'Stream not marked');
        nextChar = markedChar;
        skipLF = markedSkipLF;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.mark(int)

/**
     * Mark the present position in the stream.  Subsequent calls to reset()
     * will attempt to reposition the stream to this point.  Not all
     * character-input streams support the mark() operation.
     * @param  readAheadLimit  Limit on the number of characters that may be
     *                         read while still preserving the mark.  After
     *                         reading this many characters, attempting to
     *                         reset the stream may fail.
     * @exception  IOException  If the stream does not support mark(),
     *                          or if some other I/O error occurs
     */
public void mark(int readAheadLimit) throws IOException {
    throw new IOException(fFormatter.formatMessage(fLocale, 'OperationNotSupported', new Object[] { 'mark()', 'UTF-8' }));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedOutputStream.connect(PipedInputStream)

/**
     * Connects this piped output stream to a receiver. If this object
     * is already connected to some other piped input stream, an 
     * <code>IOException</code> is thrown.
     * If <code>snk</code> is an unconnected piped input stream and 
     * <code>src</code> is an unconnected piped output stream, they may 
     * be connected by either the call:
     * <blockquote>
     * src.connect(snk)</blockquote>
     * or the call:
     * <blockquote>
     * snk.connect(src)</blockquote>
     * The two calls have the same effect.
     * @param      snk   the piped input stream to connect to.
     * @exception  IOException  if an I/O error occurs.
     */
public synchronized void connect(PipedInputStream snk) throws IOException {
    if (snk == null) {
        throw new NullPointerException();
    } else if (sink != null || snk.connected) {
        throw new IOException('Already connected');
    }
    sink = snk;
    snk.in = -1;
    snk.out = 0;
    snk.connected = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedWriter.connect(PipedReader)

/**
     * Connects this piped writer to a receiver. If this object
     * is already connected to some other piped reader, an 
     * <code>IOException</code> is thrown.
     * If <code>snk</code> is an unconnected piped reader and 
     * <code>src</code> is an unconnected piped writer, they may 
     * be connected by either the call:
     * <blockquote>
     * src.connect(snk)</blockquote>
     * or the call:
     * <blockquote>
     * snk.connect(src)</blockquote>
     * The two calls have the same effect.
     * @param      snk   the piped reader to connect to.
     * @exception  IOException  if an I/O error occurs.
     */
public synchronized void connect(PipedReader snk) throws IOException {
    if (snk == null) {
        throw new NullPointerException();
    } else if (sink != null || snk.connected) {
        throw new IOException('Already connected');
    } else if (snk.closedByReader || closed) {
        throw new IOException('Pipe closed');
    }
    sink = snk;
    snk.in = -1;
    snk.out = 0;
    snk.connected = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.beancontext.BeanContextChildSupport.writeObject(ObjectOutputStream)

/**
     * Write the persistence state of the object.
     */
private void writeObject(ObjectOutputStream oos) throws IOException {
    if (!equals(beanContextChildPeer) && !(beanContextChildPeer instanceof Serializable)) throw new IOException('BeanContextChildSupport beanContextChildPeer not Serializable'); else oos.defaultWriteObject();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.imageio.stream.MemoryCache.getCacheBlock(long)

private byte[] getCacheBlock(long blockNum) throws IOException {
    long blockOffset = blockNum - cacheStart;
    if (blockOffset > Integer.MAX_VALUE) {
        throw new IOException('Cache addressing limit exceeded!');
    }
    return (byte[]) cache.get((int) blockOffset);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.HTMLEditorKit.insertHTML(HTMLDocument, int, String, int, int, HTML.Tag)

/**
     * Inserts HTML into an existing document.
     * @param doc       the document to insert into
     * @param offset    the offset to insert HTML at
     * @param popDepth  the number of ElementSpec.EndTagTypes to generate before
     *        inserting
     * @param pushDepth the number of ElementSpec.StartTagTypes with a direction
     *        of ElementSpec.JoinNextDirection that should be generated
     *        before inserting, but after the end tags have been generated
     * @param insertTag the first tag to start inserting into document
     * @exception RuntimeException (will eventually be a BadLocationException)
     *            if pos is invalid
     */
public void insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag) throws BadLocationException, IOException {
    Parser p = getParser();
    if (p == null) {
        throw new IOException('Can't load parser');
    }
    if (offset > doc.getLength()) {
        throw new BadLocationException('Invalid location', offset);
    }
    ParserCallback receiver = doc.getReader(offset, popDepth, pushDepth, insertTag);
    Boolean ignoreCharset = (Boolean) doc.getProperty('IgnoreCharsetDirective');
    p.parse(new StringReader(html), receiver, (ignoreCharset == null) ? false : ignoreCharset.booleanValue());
    receiver.flush();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.HTMLEditorKit.read(Reader, Document, int)

/**
     * Inserts content from the given stream. If <code>doc</code> is
     * an instance of HTMLDocument, this will read
     * HTML 3.2 text. Inserting HTML into a non-empty document must be inside
     * the body Element, if you do not insert into the body an exception will
     * be thrown. When inserting into a non-empty document all tags outside
     * of the body (head, title) will be dropped.
     * @param in  the stream to read from
     * @param doc the destination for the insertion
     * @param pos the location in the document to place the
     *   content
     * @exception IOException on any I/O error
     * @exception BadLocationException if pos represents an invalid
     *   location within the document
     * @exception RuntimeException (will eventually be a BadLocationException)
     *            if pos is invalid
     */
public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException {
    if (doc instanceof HTMLDocument) {
        HTMLDocument hdoc = (HTMLDocument) doc;
        Parser p = getParser();
        if (p == null) {
            throw new IOException('Can't load parser');
        }
        if (pos > doc.getLength()) {
            throw new BadLocationException('Invalid location', pos);
        }
        ParserCallback receiver = hdoc.getReader(pos);
        Boolean ignoreCharset = (Boolean) doc.getProperty('IgnoreCharsetDirective');
        p.parse(in, receiver, (ignoreCharset == null) ? false : ignoreCharset.booleanValue());
        receiver.flush();
    } else {
        super.read(in, doc, pos);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.Font.createFont(int, File)

/**
     * Returns a new <code>Font</code> using the specified font type
     * and the specified font file.  The new <code>Font</code> is
     * created with a point size of 1 and style {@link #PLAIN PLAIN}.
     * This base font can then be used with the <code>deriveFont</code>
     * methods in this class to derive new <code>Font</code> objects with
     * varying sizes, styles, transforms and font features.
     * @param fontFormat the type of the <code>Font</code>, which is
     * {@link #TRUETYPE_FONT TRUETYPE_FONT} if a TrueType resource is
     * specified or {@link #TYPE1_FONT TYPE1_FONT} if a Type 1 resource is
     * specified.
     * So long as the returned font, or its derived fonts are referenced
     * the implementation may continue to access <code>fontFile</code>
     * to retrieve font data. Thus the results are undefined if the file
     * is changed, or becomes inaccessible.
     * @param fontFile a <code>File</code> object representing the
     * input data for the font.
     * @return a new <code>Font</code> created with the specified font type.
     * @throws IllegalArgumentException if <code>fontFormat</code> is not
     *     <code>TRUETYPE_FONT</code>or<code>TYPE1_FONT</code>.
     * @throws NullPointerException if <code>fontFile</code> is null.
     * @throws IOException if the <code>fontFile</code> cannot be read.
     * @throws FontFormatException if <code>fontFile</code> does
     *     not contain the required font tables for the specified format.
     * @throws SecurityException if the executing code does not have
     * permission to read from the file.
     * @since 1.5
     */
public static Font createFont(int fontFormat, File fontFile) throws java.awt.FontFormatException, java.io.IOException {
    if (fontFormat != Font.TRUETYPE_FONT && fontFormat != Font.TYPE1_FONT) {
        throw new IllegalArgumentException('font format not recognized');
    }
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission filePermission = new FilePermission(fontFile.getPath(), 'read');
        sm.checkPermission(filePermission);
    }
    if (!fontFile.canRead()) {
        throw new IOException('Can't read ' + fontFile);
    }
    return new Font(fontFile, fontFormat, false);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.color.ICC_Profile.getInstance(String)

/**
     * Constructs an ICC_Profile corresponding to the data in a file.
     * fileName may be an absolute or a relative file specification.
     * Relative file names are looked for in several places: first, relative
     * to any directories specified by the java.iccprofile.path property;
     * second, relative to any directories specified by the java.class.path
     * property; finally, in a directory used to store profiles always
     * available, such as the profile for sRGB.  Built-in profiles use .pf as
     * the file name extension for profiles, e.g. sRGB.pf.
     * This method throws an IOException if the specified file cannot be
     * opened or if an I/O error occurs while reading the file.  It throws
     * an IllegalArgumentException if the file does not contain valid ICC
     * Profile data.
     * @param fileName The file that contains the data for the profile.
     * @return an <code>ICC_Profile</code> object corresponding to
     *          the data in the specified file.
     * @exception IOException If the specified file cannot be opened or
     * an I/O error occurs while reading the file.
     * @exception IllegalArgumentException If the file does not
     * contain valid ICC Profile data. 
     * @exception SecurityException If a security manager is installed
     * and it does not permit read access to the given file.
     */
public static ICC_Profile getInstance(String fileName) throws IOException {
    ICC_Profile thisProfile;
    FileInputStream fis;
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkRead(fileName);
    }
    if ((fis = openProfile(fileName)) == null) {
        throw new IOException('Cannot open file ' + fileName);
    }
    thisProfile = getInstance(fis);
    fis.close();
    return thisProfile;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.remote.rmi.RMIConnector.getMBeanServerConnection(Subject)

public synchronized MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) throws IOException {
    if (terminated) {
        if (logger.traceOn()) logger.trace('getMBeanServerConnection', '[' + this.toString() + '] already closed.');
        throw new IOException('Connection closed');
    } else if (!connected) {
        if (logger.traceOn()) logger.trace('getMBeanServerConnection', '[' + this.toString() + '] is not connected.');
        throw new IOException('Not connected');
    }
    MBeanServerConnection mbsc = (MBeanServerConnection) rmbscMap.get(delegationSubject);
    if (mbsc != null) return mbsc;
    mbsc = new RemoteMBeanServerConnection(delegationSubject);
    rmbscMap.put(delegationSubject, mbsc);
    return mbsc;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.filechooser.FileSystemView.createNewFolder(File)

/**
     * Creates a new folder with a default folder name.
     */
public File createNewFolder(File containingDir) throws IOException {
    if (containingDir == null) {
        throw new IOException('Containing directory is null:');
    }
    File newFolder = null;
    newFolder = createFileObject(containingDir, newFolderString);
    if (newFolder.exists()) {
        throw new IOException('Directory already exists:' + newFolder.getAbsolutePath());
    } else {
        newFolder.mkdirs();
    }
    return newFolder;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.filechooser.FileSystemView.createNewFolder(File)

/**
     * Creates a new folder with a default folder name.
     */
public File createNewFolder(File containingDir) throws IOException {
    if (containingDir == null) {
        throw new IOException('Containing directory is null:');
    }
    File newFolder = null;
    newFolder = createFileObject(containingDir, newFolderString);
    int i = 1;
    while (newFolder.exists() && (i < 100)) {
        newFolder = createFileObject(containingDir, MessageFormat.format(newFolderNextString, new Object[] { new Integer(i) }));
        i++;
    }
    if (newFolder.exists()) {
        throw new IOException('Directory already exists:' + newFolder.getAbsolutePath());
    } else {
        newFolder.mkdirs();
    }
    return newFolder;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.filechooser.FileSystemView.createNewFolder(File)

/**
     * Creates a new folder with a default folder name.
     */
public File createNewFolder(File containingDir) throws IOException {
    if (containingDir == null) {
        throw new IOException('Containing directory is null:');
    }
    File newFolder = null;
    newFolder = createFileObject(containingDir, newFolderString);
    int i = 2;
    while (newFolder.exists() && (i < 100)) {
        newFolder = createFileObject(containingDir, MessageFormat.format(newFolderNextString, new Object[] { new Integer(i) }));
        i++;
    }
    if (newFolder.exists()) {
        throw new IOException('Directory already exists:' + newFolder.getAbsolutePath());
    } else {
        newFolder.mkdirs();
    }
    return newFolder;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.GZIPInputStream.readHeader()

private void readHeader() throws IOException {
    CheckedInputStream in = new CheckedInputStream(this.in, crc);
    crc.reset();
    if (readUShort(in) != GZIP_MAGIC) {
        throw new IOException('Not in GZIP format');
    }
    if (readUByte(in) != 8) {
        throw new IOException('Unsupported compression method');
    }
    int flg = readUByte(in);
    skipBytes(in, 6);
    if ((flg & FEXTRA) == FEXTRA) {
        skipBytes(in, readUShort(in));
    }
    if ((flg & FNAME) == FNAME) {
        while (readUByte(in) != 0) ;
    }
    if ((flg & FCOMMENT) == FCOMMENT) {
        while (readUByte(in) != 0) ;
    }
    if ((flg & FHCRC) == FHCRC) {
        int v = (int) crc.getValue() & 0xffff;
        if (readUShort(in) != v) {
            throw new IOException('Corrupt GZIP header');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.GZIPInputStream.readTrailer()

private void readTrailer() throws IOException {
    InputStream in = this.in;
    int n = inf.getRemaining();
    if (n > 0) {
        in = new SequenceInputStream(new ByteArrayInputStream(buf, len - n, n), in);
    }
    if ((readUInt(in) != crc.getValue()) || (readUInt(in) != (inf.getBytesWritten() & 0xffffffffL))) throw new IOException('Corrupt GZIP trailer');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.sound.sampled.AudioInputStream.skip(long)

/**
     * Skips over and discards a specified number of bytes from this
     * audio input stream.
     * @param n the requested number of bytes to be skipped
     * @return the actual number of bytes skipped
     * @throws IOException if an input or output error occurs
     * @see #read
     * @see #available
     */
public long skip(long n) throws IOException {
    if ((n % frameSize) != 0) {
        n -= (n % frameSize);
    }
    if (frameLength != AudioSystem.NOT_SPECIFIED) {
        if ((n / frameSize) > (frameLength - framePos)) {
            n = (frameLength - framePos) * frameSize;
        }
    }
    long temp = stream.skip(n);
    if (temp % frameSize != 0) {
        throw new IOException('Could not skip an integer number of frames.');
    }
    if (temp >= 0) {
        framePos += temp / frameSize;
    }
    return temp;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.util.ClassPath.getBytes(String, String)

/**
   * @param name fully qualified file name, e.g. java/lang/String
   * @param suffix file name ends with suffix, e.g. .java
   * @return byte array for file on class path
   */
public byte[] getBytes(String name, String suffix) throws IOException {
    InputStream is = getInputStream(name, suffix);
    if (is == null) throw new IOException('Couldn't find: ' + name + suffix);
    DataInputStream dis = new DataInputStream(is);
    byte[] bytes = new byte[is.available()];
    dis.readFully(bytes);
    dis.close();
    is.close();
    return bytes;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.util.ClassPath.getClassFile(String, String)

/**
   * @param name fully qualified file name, e.g. java/lang/String
   * @param suffix file name ends with suff, e.g. .java
   * @return class file for the java class
   */
public ClassFile getClassFile(String name, String suffix) throws IOException {
    for (int i = 0; i < paths.length; i++) {
        ClassFile cf;
        if ((cf = paths[i].getClassFile(name, suffix)) != null) return cf;
    }
    throw new IOException('Couldn't find: ' + name + suffix);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.logging.FileHandler.openFiles()

private void openFiles() throws IOException {
    LogManager manager = LogManager.getLogManager();
    manager.checkAccess();
    if (count < 1) {
        throw new IllegalArgumentException('file count = ' + count);
    }
    if (limit < 0) {
        limit = 0;
    }
    InitializationErrorManager em = new InitializationErrorManager();
    setErrorManager(em);
    int unique = -1;
    for (; ; ) {
        unique++;
        if (unique > MAX_LOCKS) {
            throw new IOException('Couldn't get lock for ' + pattern);
        }
        lockFileName = generate(pattern, 0, unique).toString() + '.lck';
        synchronized (locks) {
            if (locks.get(lockFileName) != null) {
                continue;
            }
            FileChannel fc;
            try {
                lockStream = new FileOutputStream(lockFileName);
                fc = lockStream.getChannel();
            } catch (IOException ix) {
                continue;
            }
            try {
                FileLock fl = fc.tryLock();
                if (fl == null) {
                    continue;
                }
            } catch (IOException ix) {
            }
            locks.put(lockFileName, lockFileName);
            break;
        }
    }
    files = new File[count];
    for (int i = 0; i < count; i++) {
        files[i] = generate(pattern, i, unique);
    }
    if (append) {
        open(files[0], true);
    } else {
        rotate();
    }
    Exception ex = em.lastException;
    if (ex != null) {
        if (ex instanceof IOException) {
            throw (IOException) ex;
        } else if (ex instanceof SecurityException) {
            throw (SecurityException) ex;
        } else {
            throw new IOException('Exception: ' + ex);
        }
    }
    setErrorManager(new ErrorManager());
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(ByteBuffer, int, long)

public void readFully(ByteBuffer byteBuffer, int size, long max_wait_time) throws IOException {
    int n = 0;
    int bytecount = 0;
    long time_to_wait = readTimeouts.get_initial_time_to_wait();
    long total_time_in_wait = 0;
    do {
        bytecount = getSocketChannel().read(byteBuffer);
        if (bytecount < 0) {
            throw new IOException('End-of-stream');
        } else if (bytecount == 0) {
            try {
                Thread.sleep(time_to_wait);
                total_time_in_wait += time_to_wait;
                time_to_wait = (long) (time_to_wait * readTimeouts.get_backoff_factor());
            } catch (InterruptedException ie) {
                if (orb.transportDebugFlag) {
                    dprint('readFully(): unexpected exception ' + ie.toString());
                }
            }
        } else {
            n += bytecount;
        }
    } while (n < size && total_time_in_wait < max_wait_time);
    if (n < size && total_time_in_wait >= max_wait_time) {
        throw wrapper.transportReadTimeoutExceeded(new Integer(size), new Integer(n), new Long(max_wait_time), new Long(total_time_in_wait));
    }
    getConnectionCache().stampTime(this);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(java.io.InputStream, byte[], int, int, long)

public void readFully(java.io.InputStream is, byte[] buf, int offset, int size, long max_wait_time) throws IOException {
    int n = 0;
    int bytecount = 0;
    long time_to_wait = readTimeouts.get_initial_time_to_wait();
    long total_time_in_wait = 0;
    do {
        bytecount = is.read(buf, offset + n, size - n);
        if (bytecount < 0) {
            throw new IOException('End-of-stream');
        } else if (bytecount == 0) {
            try {
                Thread.sleep(time_to_wait);
                total_time_in_wait += time_to_wait;
                time_to_wait = (long) (time_to_wait * readTimeouts.get_backoff_factor());
            } catch (InterruptedException ie) {
                if (orb.transportDebugFlag) {
                    dprint('readFully(): unexpected exception ' + ie.toString());
                }
            }
        } else {
            n += bytecount;
        }
    } while (n < size && total_time_in_wait < max_wait_time);
    if (n < size && total_time_in_wait >= max_wait_time) {
        throw wrapper.transportReadTimeoutExceeded(new Integer(size), new Integer(n), new Long(max_wait_time), new Long(total_time_in_wait));
    }
    getConnectionCache().stampTime(this);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPOutputStream.reset()

/**
     * Reset will disregard the state of any objects already written
     * to the stream.  The state is reset to be the same as a new
     * ObjectOutputStream.  The current point in the stream is marked
     * as reset so the corresponding ObjectInputStream will be reset
     * at the same point.  Objects previously written to the stream
     * will not be refered to as already being in the stream.  They
     * will be written to the stream again.
     * @since     JDK1.1
     */
public final void reset() throws IOException {
    try {
        if (currentObject != null || currentClassDesc != null) throw new IOException('Illegal call to reset');
        abortIOException = null;
        if (classDescStack == null) classDescStack = new java.util.Stack(); else classDescStack.setSize(0);
    } catch (Error e) {
        IOException ioexc = new IOException(e.getMessage());
        ioexc.initCause(e);
        throw ioexc;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.internal.ClientNotifForwarder.preReconnection()

public synchronized ClientListenerInfo[] preReconnection() throws IOException {
    if (state == TERMINATED || beingReconnected) {
        throw new IOException('Illegal state.');
    }
    final ClientListenerInfo[] tmp = (ClientListenerInfo[]) infoList.values().toArray(new ClientListenerInfo[0]);
    beingReconnected = true;
    infoList.clear();
    if (currentFetchThread == Thread.currentThread()) {
        return tmp;
    }
    while (state == STARTING) {
        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);
            throw ioe;
        }
    }
    if (state == STARTED) {
        setState(STOPPING);
    }
    return tmp;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageWriter.write(IIOMetadata, IIOImage, ImageWriteParam)

public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException {
    if (stream == null) {
        throw new IllegalStateException(I18N.getString('BMPImageWriter7'));
    }
    if (image == null) {
        throw new IllegalArgumentException(I18N.getString('BMPImageWriter8'));
    }
    clearAbortRequest();
    processImageStarted(0);
    if (param == null) param = getDefaultWriteParam();
    BMPImageWriteParam bmpParam = (BMPImageWriteParam) param;
    int bitsPerPixel = 24;
    boolean isPalette = false;
    int paletteEntries = 0;
    IndexColorModel icm = null;
    RenderedImage input = null;
    Raster inputRaster = null;
    boolean writeRaster = image.hasRaster();
    Rectangle sourceRegion = param.getSourceRegion();
    SampleModel sampleModel = null;
    ColorModel colorModel = null;
    compImageSize = 0;
    if (writeRaster) {
        inputRaster = image.getRaster();
        sampleModel = inputRaster.getSampleModel();
        colorModel = ImageUtil.createColorModel(null, sampleModel);
        if (sourceRegion == null) sourceRegion = inputRaster.getBounds(); else sourceRegion = sourceRegion.intersection(inputRaster.getBounds());
    } else {
        input = image.getRenderedImage();
        sampleModel = input.getSampleModel();
        colorModel = input.getColorModel();
        Rectangle rect = new Rectangle(input.getMinX(), input.getMinY(), input.getWidth(), input.getHeight());
        if (sourceRegion == null) sourceRegion = rect; else sourceRegion = sourceRegion.intersection(rect);
    }
    IIOMetadata imageMetadata = image.getMetadata();
    BMPMetadata bmpImageMetadata = null;
    if (imageMetadata != null && imageMetadata instanceof BMPMetadata) {
        bmpImageMetadata = (BMPMetadata) imageMetadata;
    } else {
        ImageTypeSpecifier imageType = new ImageTypeSpecifier(colorModel, sampleModel);
        bmpImageMetadata = (BMPMetadata) getDefaultImageMetadata(imageType, param);
    }
    if (sourceRegion.isEmpty()) throw new RuntimeException(I18N.getString('BMPImageWrite0'));
    int scaleX = param.getSourceXSubsampling();
    int scaleY = param.getSourceYSubsampling();
    int xOffset = param.getSubsamplingXOffset();
    int yOffset = param.getSubsamplingYOffset();
    int dataType = sampleModel.getDataType();
    sourceRegion.translate(xOffset, yOffset);
    sourceRegion.width -= xOffset;
    sourceRegion.height -= yOffset;
    int minX = sourceRegion.x / scaleX;
    int minY = sourceRegion.y / scaleY;
    w = (sourceRegion.width + scaleX - 1) / scaleX;
    h = (sourceRegion.height + scaleY - 1) / scaleY;
    xOffset = sourceRegion.x % scaleX;
    yOffset = sourceRegion.y % scaleY;
    Rectangle destinationRegion = new Rectangle(minX, minY, w, h);
    boolean noTransform = destinationRegion.equals(sourceRegion);
    int[] sourceBands = param.getSourceBands();
    boolean noSubband = true;
    int numBands = sampleModel.getNumBands();
    if (sourceBands != null) {
        sampleModel = sampleModel.createSubsetSampleModel(sourceBands);
        colorModel = null;
        noSubband = false;
        numBands = sampleModel.getNumBands();
    } else {
        sourceBands = new int[numBands];
        for (int i = 0; i < numBands; i++) sourceBands[i] = i;
    }
    int[] bandOffsets = null;
    boolean bgrOrder = true;
    if (sampleModel instanceof ComponentSampleModel) {
        bandOffsets = ((ComponentSampleModel) sampleModel).getBandOffsets();
        if (sampleModel instanceof BandedSampleModel) {
            bgrOrder = false;
        } else {
            for (int i = 0; i < bandOffsets.length; i++) bgrOrder &= bandOffsets[i] == bandOffsets.length - i - 1;
        }
    } else {
        bandOffsets = new int[numBands];
        for (int i = 0; i < numBands; i++) bandOffsets[i] = i;
    }
    if (bgrOrder && sampleModel instanceof SinglePixelPackedSampleModel) {
        int[] bitOffsets = ((SinglePixelPackedSampleModel) sampleModel).getBitOffsets();
        for (int i = 0; i < bitOffsets.length - 1; i++) {
            bgrOrder &= bitOffsets[i] > bitOffsets[i + 1];
        }
    }
    noTransform &= bgrOrder;
    int sampleSize[] = sampleModel.getSampleSize();
    int destScanlineBytes = w * numBands;
    switch(bmpParam.getCompressionMode()) {
        case ImageWriteParam.MODE_EXPLICIT:
            compressionType = getCompressionType(bmpParam.getCompressionType());
            break;
        case ImageWriteParam.MODE_COPY_FROM_METADATA:
            compressionType = bmpImageMetadata.compression;
            break;
        case ImageWriteParam.MODE_DEFAULT:
            compressionType = getPreferredCompressionType(colorModel, sampleModel);
            break;
        default:
            compressionType = BI_RGB;
    }
    if (!canEncodeImage(compressionType, colorModel, sampleModel)) {
        throw new IOException('Image can not be encoded with compression type ' + compressionTypeNames[compressionType]);
    }
    byte r[] = null, g[] = null, b[] = null, a[] = null;
    if (colorModel instanceof IndexColorModel) {
        isPalette = true;
        icm = (IndexColorModel) colorModel;
        paletteEntries = icm.getMapSize();
        if (paletteEntries <= 2) {
            bitsPerPixel = 1;
            destScanlineBytes = w + 7 >> 3;
        } else if (paletteEntries <= 16) {
            bitsPerPixel = 4;
            destScanlineBytes = w + 1 >> 1;
        } else if (paletteEntries <= 256) {
            bitsPerPixel = 8;
        } else {
            bitsPerPixel = 24;
            isPalette = false;
            paletteEntries = 0;
            destScanlineBytes = w * 3;
        }
        if (isPalette == true) {
            r = new byte[paletteEntries];
            g = new byte[paletteEntries];
            b = new byte[paletteEntries];
            a = new byte[paletteEntries];
            icm.getAlphas(a);
            icm.getReds(r);
            icm.getGreens(g);
            icm.getBlues(b);
        }
    } else {
        if (numBands == 1) {
            isPalette = true;
            paletteEntries = 256;
            bitsPerPixel = sampleSize[0];
            destScanlineBytes = (w * bitsPerPixel + 7 >> 3);
            r = new byte[256];
            g = new byte[256];
            b = new byte[256];
            a = new byte[256];
            for (int i = 0; i < 256; i++) {
                r[i] = (byte) i;
                g[i] = (byte) i;
                b[i] = (byte) i;
                a[i] = (byte) 255;
            }
        } else {
            if (sampleModel instanceof SinglePixelPackedSampleModel && noSubband) {
                bitsPerPixel = DataBuffer.getDataTypeSize(sampleModel.getDataType());
                destScanlineBytes = w * bitsPerPixel + 7 >> 3;
                if (compressionType == BMPConstants.BI_BITFIELDS) {
                    isPalette = true;
                    paletteEntries = 3;
                    r = new byte[paletteEntries];
                    g = new byte[paletteEntries];
                    b = new byte[paletteEntries];
                    a = new byte[paletteEntries];
                    if (bitsPerPixel == 16) {
                        b[0] = (byte) 0x00;
                        g[0] = (byte) 0x00;
                        r[0] = (byte) 0xF8;
                        a[0] = (byte) 0x00;
                        b[1] = (byte) 0x00;
                        g[1] = (byte) 0x00;
                        r[1] = (byte) 0x07;
                        a[1] = (byte) 0xE0;
                        b[2] = (byte) 0x00;
                        g[2] = (byte) 0x00;
                        r[2] = (byte) 0x00;
                        a[2] = (byte) 0x1F;
                    } else if (bitsPerPixel == 32) {
                        b[0] = (byte) 0x00;
                        g[0] = (byte) 0xFF;
                        r[0] = (byte) 0x00;
                        a[0] = (byte) 0x00;
                        b[1] = (byte) 0x00;
                        g[1] = (byte) 0x00;
                        r[1] = (byte) 0xFF;
                        a[1] = (byte) 0x00;
                        b[2] = (byte) 0x00;
                        g[2] = (byte) 0x00;
                        r[2] = (byte) 0x00;
                        a[2] = (byte) 0xFF;
                    } else {
                        throw new RuntimeException(I18N.getString('BMPImageWrite6'));
                    }
                }
            }
        }
    }
    int fileSize = 0;
    int offset = 0;
    int headerSize = 0;
    int imageSize = 0;
    int xPelsPerMeter = 0;
    int yPelsPerMeter = 0;
    int colorsUsed = 0;
    int colorsImportant = paletteEntries;
    int padding = destScanlineBytes % 4;
    if (padding != 0) {
        padding = 4 - padding;
    }
    if (sampleModel instanceof SinglePixelPackedSampleModel && noSubband) {
        destScanlineBytes = w;
        bitPos = ((SinglePixelPackedSampleModel) sampleModel).getBitMasks();
        for (int i = 0; i < bitPos.length; i++) bitPos[i] = firstLowBit(bitPos[i]);
    }
    offset = 54 + paletteEntries * 4;
    imageSize = (destScanlineBytes + padding) * h;
    fileSize = imageSize + offset;
    headerSize = 40;
    long headPos = stream.getStreamPosition();
    writeFileHeader(fileSize, offset);
    writeInfoHeader(headerSize, bitsPerPixel);
    stream.writeInt(compressionType);
    stream.writeInt(imageSize);
    stream.writeInt(xPelsPerMeter);
    stream.writeInt(yPelsPerMeter);
    stream.writeInt(colorsUsed);
    stream.writeInt(colorsImportant);
    if (isPalette == true) {
        if (compressionType == BMPConstants.BI_BITFIELDS) {
            for (int i = 0; i < 3; i++) {
                int mask = (a[i] & 0xFF) + ((r[i] & 0xFF) * 0x100) + ((g[i] & 0xFF) * 0x10000) + ((b[i] & 0xFF) * 0x1000000);
                stream.writeInt(mask);
            }
        } else {
            for (int i = 0; i < paletteEntries; i++) {
                stream.writeByte(b[i]);
                stream.writeByte(g[i]);
                stream.writeByte(r[i]);
                stream.writeByte(a[i]);
            }
        }
    }
    int scanlineBytes = w * numBands;
    int[] pixels = new int[scanlineBytes * scaleX];
    bpixels = new byte[destScanlineBytes];
    int l;
    if (compressionType == BMPConstants.BI_JPEG || compressionType == BMPConstants.BI_PNG) {
        embedded_stream = new ByteArrayOutputStream();
        writeEmbedded(image, bmpParam);
        embedded_stream.flush();
        imageSize = embedded_stream.size();
        long endPos = stream.getStreamPosition();
        fileSize = (int) (offset + imageSize);
        stream.seek(headPos);
        writeSize(fileSize, 2);
        stream.seek(headPos);
        writeSize(imageSize, 34);
        stream.seek(endPos);
        stream.write(embedded_stream.toByteArray());
        embedded_stream = null;
        if (abortRequested()) {
            processWriteAborted();
        } else {
            processImageComplete();
            stream.flushBefore(stream.getStreamPosition());
        }
        return;
    }
    isTopDown = bmpParam.isTopDown();
    int maxBandOffset = bandOffsets[0];
    for (int i = 1; i < bandOffsets.length; i++) if (bandOffsets[i] > maxBandOffset) maxBandOffset = bandOffsets[i];
    int[] pixel = new int[maxBandOffset + 1];
    for (int i = 0; i < h; i++) {
        if (abortRequested()) {
            break;
        }
        int row = minY + i;
        if (!isTopDown) row = minY + h - i - 1;
        Raster src = inputRaster;
        Rectangle srcRect = new Rectangle(minX * scaleX + xOffset, row * scaleY + yOffset, (w - 1) * scaleX + 1, 1);
        if (!writeRaster) src = input.getData(srcRect);
        if (noTransform && noSubband) {
            SampleModel sm = src.getSampleModel();
            int pos = 0;
            int startX = srcRect.x - src.getSampleModelTranslateX();
            int startY = srcRect.y - src.getSampleModelTranslateY();
            if (sm instanceof ComponentSampleModel) {
                ComponentSampleModel csm = (ComponentSampleModel) sm;
                pos = csm.getOffset(startX, startY, 0);
                for (int nb = 1; nb < csm.getNumBands(); nb++) {
                    if (pos > csm.getOffset(startX, startY, nb)) {
                        pos = csm.getOffset(startX, startY, nb);
                    }
                }
            } else if (sm instanceof MultiPixelPackedSampleModel) {
                MultiPixelPackedSampleModel mppsm = (MultiPixelPackedSampleModel) sm;
                pos = mppsm.getOffset(startX, startY);
            } else if (sm instanceof SinglePixelPackedSampleModel) {
                SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel) sm;
                pos = sppsm.getOffset(startX, startY);
            }
            if (compressionType == BMPConstants.BI_RGB || compressionType == BMPConstants.BI_BITFIELDS) {
                switch(dataType) {
                    case DataBuffer.TYPE_BYTE:
                        byte[] bdata = ((DataBufferByte) src.getDataBuffer()).getData();
                        stream.write(bdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_SHORT:
                        short[] sdata = ((DataBufferShort) src.getDataBuffer()).getData();
                        stream.writeShorts(sdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_USHORT:
                        short[] usdata = ((DataBufferUShort) src.getDataBuffer()).getData();
                        stream.writeShorts(usdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_INT:
                        int[] idata = ((DataBufferInt) src.getDataBuffer()).getData();
                        stream.writeInts(idata, pos, destScanlineBytes);
                        break;
                }
                for (int k = 0; k < padding; k++) {
                    stream.writeByte(0);
                }
            } else if (compressionType == BMPConstants.BI_RLE4) {
                if (bpixels == null || bpixels.length < scanlineBytes) bpixels = new byte[scanlineBytes];
                src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
                for (int h = 0; h < scanlineBytes; h++) {
                    bpixels[h] = (byte) pixels[h];
                }
                encodeRLE4(bpixels, scanlineBytes);
            } else if (compressionType == BMPConstants.BI_RLE8) {
                if (bpixels == null || bpixels.length < scanlineBytes) bpixels = new byte[scanlineBytes];
                src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
                for (int h = 0; h < scanlineBytes; h++) {
                    bpixels[h] = (byte) pixels[h];
                }
                encodeRLE8(bpixels, scanlineBytes);
            }
        } else {
            src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
            if (scaleX != 1 || maxBandOffset != numBands - 1 || bgrOrder) for (int j = 0, k = 0, n = 0; j < w; j++, k += scaleX * numBands, n += numBands) {
                System.arraycopy(pixels, k, pixel, 0, pixel.length);
                for (int m = 0; m < numBands; m++) pixels[n + numBands - m - 1] = pixel[bandOffsets[sourceBands[m]]];
            }
            writePixels(0, scanlineBytes, bitsPerPixel, pixels, padding, numBands, icm);
        }
        processImageProgress(100.0f * (((float) i) / ((float) h)));
    }
    if (compressionType == BMPConstants.BI_RLE4 || compressionType == BMPConstants.BI_RLE8) {
        stream.writeByte(0);
        stream.writeByte(1);
        incCompImageSize(2);
        imageSize = compImageSize;
        fileSize = compImageSize + offset;
        long endPos = stream.getStreamPosition();
        stream.seek(headPos);
        writeSize(fileSize, 2);
        stream.seek(headPos);
        writeSize(imageSize, 34);
        stream.seek(endPos);
    }
    if (abortRequested()) {
        processWriteAborted();
    } else {
        processImageComplete();
        stream.flushBefore(stream.getStreamPosition());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.snmp.daemon.SnmpSocket.sendPacket(DatagramPacket)

/**
     * Sends a datagram packet to a specified device at specified port.
     * @param dgrmpkt The datagram packet.
     * @exception IOException Signals that an I/O exception of some sort has occurred.
     */
public synchronized void sendPacket(DatagramPacket dgrmpkt) throws IOException {
    try {
        if (isValid()) {
            if (isTraceOn()) {
                trace('sendPacket', 'Sending DatagramPacket. Length = ' + dgrmpkt.getLength() + ' through socket = ' + _socket.toString());
            }
            _socket.send(dgrmpkt);
        } else throw new IOException('Invalid state of SNMP datagram socket.');
    } catch (IOException e) {
        if (isDebugOn()) {
            debug('sendPacket', 'Io error while sending');
            debug('sendPacket', e.getMessage());
        }
        throw e;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.logging.LogRecord.readObject(ObjectInputStream)

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    byte major = in.readByte();
    byte minor = in.readByte();
    if (major != 1) {
        throw new IOException('LogRecord: bad version: ' + major + '.' + minor);
    }
    int len = in.readInt();
    if (len == -1) {
        parameters = null;
    } else {
        parameters = new Object[len];
        for (int i = 0; i < parameters.length; i++) {
            parameters[i] = in.readObject();
        }
    }
    if (resourceBundleName != null) {
        try {
            resourceBundle = ResourceBundle.getBundle(resourceBundleName);
        } catch (MissingResourceException ex) {
            resourceBundle = null;
        }
    }
    needToInferCaller = false;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.SocketImpl.shutdownInput()

/**
     * Places the input stream for this socket at 'end of stream'.
     * Any data sent to this socket is acknowledged and then
     * silently discarded.
     * If you read from a socket input stream after invoking 
     * shutdownInput() on the socket, the stream will return EOF.
     * @exception IOException if an I/O error occurs when shutting down this
     * socket.
     * @see java.net.Socket#shutdownOutput()
     * @see java.net.Socket#close()
     * @see java.net.Socket#setSoLinger(boolean, int)
     */
protected void shutdownInput() throws IOException {
    throw new IOException('Method not implemented!');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.SocketImpl.shutdownOutput()

/**
     * Disables the output stream for this socket.
     * For a TCP socket, any previously written data will be sent
     * followed by TCP's normal connection termination sequence.
     * If you write to a socket output stream after invoking 
     * shutdownOutput() on the socket, the stream will throw 
     * an IOException.
     * @exception IOException if an I/O error occurs when shutting down this
     * socket.
     * @see java.net.Socket#shutdownInput()
     * @see java.net.Socket#close()
     * @see java.net.Socket#setSoLinger(boolean, int)
     */
protected void shutdownOutput() throws IOException {
    throw new IOException('Method not implemented!');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPInputStream.readLine()

public final String readLine() throws IOException {
    throw new IOException('Method readLine not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPOutputStream.replaceObject(Object)

protected final Object replaceObject(Object obj) throws IOException {
    throw new IOException('Method replaceObject not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPInputStream.resolveClass(ObjectStreamClass)

protected final Class resolveClass(ObjectStreamClass v) throws IOException, ClassNotFoundException {
    throw new IOException('Method resolveClass not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPInputStream.resolveObject(Object)

protected final Object resolveObject(Object obj) throws IOException {
    throw new IOException('Method resolveObject not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.imageio.stream.MemoryCache.loadFromStream(InputStream, long)

/**
     * Ensures that at least <code>pos</code> bytes are cached,
     * or the end of the source is reached.  The return value
     * is equal to the smaller of <code>pos</code> and the
     * length of the source.
     */
public long loadFromStream(InputStream stream, long pos) throws IOException {
    if (pos < length) {
        return pos;
    }
    int offset = (int) (length % BUFFER_LENGTH);
    byte[] buf = null;
    long len = pos - length;
    if (offset != 0) {
        buf = getCacheBlock(length / BUFFER_LENGTH);
    }
    while (len > 0) {
        if (buf == null) {
            try {
                buf = new byte[BUFFER_LENGTH];
            } catch (OutOfMemoryError e) {
                throw new IOException('No memory left for cache!');
            }
            offset = 0;
        }
        int left = BUFFER_LENGTH - offset;
        int nbytes = (int) Math.min(len, (long) left);
        nbytes = stream.read(buf, offset, nbytes);
        if (nbytes == -1) {
            return length;
        }
        if (offset == 0) {
            cache.add(buf);
        }
        len -= nbytes;
        length += nbytes;
        offset += nbytes;
        if (offset >= BUFFER_LENGTH) {
            buf = null;
        }
    }
    return pos;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.imageio.stream.MemoryCache.pad(long)

/**
     * Ensure that there is space to write a byte at the given position.
     */
private void pad(long pos) throws IOException {
    long currIndex = cacheStart + cache.size() - 1;
    long lastIndex = pos / BUFFER_LENGTH;
    long numNewBuffers = lastIndex - currIndex;
    for (long i = 0; i < numNewBuffers; i++) {
        try {
            cache.add(new byte[BUFFER_LENGTH]);
        } catch (OutOfMemoryError e) {
            throw new IOException('No memory left for cache!');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.remote.rmi.RMIConnector.getConnectionId()

public synchronized String getConnectionId() throws IOException {
    if (terminated || !connected) {
        if (logger.traceOn()) logger.trace('getConnectionId', '[' + this.toString() + '] not connected.');
        throw new IOException('Not connected');
    }
    return connection.getConnectionId();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedInputStream.awaitSpace()

private void awaitSpace() throws IOException {
    while (in == out) {
        if ((readSide != null) && !readSide.isAlive()) {
            throw new IOException('Pipe broken');
        }
        notifyAll();
        try {
            wait(1000);
        } catch (InterruptedException ex) {
            throw new java.io.InterruptedIOException();
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedInputStream.read()

/**
     * Reads the next byte of data from this piped input stream. The
     * value byte is returned as an <code>int</code> in the range
     * <code>0</code> to <code>255</code>. If no byte is available
     * because the end of the stream has been reached, the value
     * <code>-1</code> is returned. This method blocks until input data
     * is available, the end of the stream is detected, or an exception
     * is thrown.
     * If a thread was providing data bytes
     * to the connected piped output stream, but
     * the  thread is no longer alive, then an
     * <code>IOException</code> is thrown.
     * @return     the next byte of data, or <code>-1</code> if the end of the
     *             stream is reached.
     * @exception  IOException  if the pipe is broken.
     */
public synchronized int read() throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByReader) {
        throw new IOException('Pipe closed');
    } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) {
        throw new IOException('Write end dead');
    }
    readSide = Thread.currentThread();
    int trials = 2;
    while (in < 0) {
        if (closedByWriter) {
            return -1;
        }
        if ((writeSide != null) && (!writeSide.isAlive()) && (--trials < 0)) {
            throw new IOException('Pipe broken');
        }
        notifyAll();
        try {
            wait(1000);
        } catch (InterruptedException ex) {
            throw new java.io.InterruptedIOException();
        }
    }
    int ret = buffer[out++] & 0xFF;
    if (out >= buffer.length) {
        out = 0;
    }
    if (in == out) {
        in = -1;
    }
    return ret;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedReader.read()

/**
     * Reads the next character of data from this piped stream.
     * If no character is available because the end of the stream 
     * has been reached, the value <code>-1</code> is returned. 
     * This method blocks until input data is available, the end of
     * the stream is detected, or an exception is thrown. 
     * If a thread was providing data characters
     * to the connected piped writer, but
     * the  thread is no longer alive, then an
     * <code>IOException</code> is thrown.
     * @return     the next character of data, or <code>-1</code> if the end of the
     *             stream is reached.
     * @exception  IOException  if the pipe is broken.
     */
public synchronized int read() throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByReader) {
        throw new IOException('Pipe closed');
    } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) {
        throw new IOException('Write end dead');
    }
    readSide = Thread.currentThread();
    int trials = 2;
    while (in < 0) {
        if (closedByWriter) {
            return -1;
        }
        if ((writeSide != null) && (!writeSide.isAlive()) && (--trials < 0)) {
            throw new IOException('Pipe broken');
        }
        notifyAll();
        try {
            wait(1000);
        } catch (InterruptedException ex) {
            throw new java.io.InterruptedIOException();
        }
    }
    int ret = buffer[out++];
    if (out >= buffer.length) {
        out = 0;
    }
    if (in == out) {
        in = -1;
    }
    return ret;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedReader.receive(int)

/**
     * Receives a char of data.  This method will block if no input is
     * available.
     */
synchronized void receive(int c) throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByWriter || closedByReader) {
        throw new IOException('Pipe closed');
    } else if (readSide != null && !readSide.isAlive()) {
        throw new IOException('Read end dead');
    }
    writeSide = Thread.currentThread();
    while (in == out) {
        if ((readSide != null) && !readSide.isAlive()) {
            throw new IOException('Pipe broken');
        }
        notifyAll();
        try {
            wait(1000);
        } catch (InterruptedException ex) {
            throw new java.io.InterruptedIOException();
        }
    }
    if (in < 0) {
        in = 0;
        out = 0;
    }
    buffer[in++] = (char) c;
    if (in >= buffer.length) {
        in = 0;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedInputStream.checkStateForReceive()

private void checkStateForReceive() throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByWriter || closedByReader) {
        throw new IOException('Pipe closed');
    } else if (readSide != null && !readSide.isAlive()) {
        throw new IOException('Read end dead');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedReader.read(char, int, int)

/**
     * Reads up to <code>len</code> characters of data from this piped
     * stream into an array of characters. Less than <code>len</code> characters
     * will be read if the end of the data stream is reached. This method 
     * blocks until at least one character of input is available. 
     * If a thread was providing data characters to the connected piped output, 
     * but the thread is no longer alive, then an <code>IOException</code> 
     * is thrown.
     * @param      cbuf     the buffer into which the data is read.
     * @param      off   the start offset of the data.
     * @param      len   the maximum number of characters read.
     * @return     the total number of characters read into the buffer, or
     *             <code>-1</code> if there is no more data because the end of
     *             the stream has been reached.
     * @exception  IOException  if an I/O error occurs.
     */
public synchronized int read(char cbuf[], int off, int len) throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByReader) {
        throw new IOException('Pipe closed');
    } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) {
        throw new IOException('Write end dead');
    }
    if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
        throw new IndexOutOfBoundsException();
    } else if (len == 0) {
        return 0;
    }
    int c = read();
    if (c < 0) {
        return -1;
    }
    cbuf[off] = (char) c;
    int rlen = 1;
    while ((in >= 0) && (--len > 0)) {
        cbuf[off + rlen] = buffer[out++];
        rlen++;
        if (out >= buffer.length) {
            out = 0;
        }
        if (in == out) {
            in = -1;
        }
    }
    return rlen;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedReader.ready()

/**
     * Tell whether this stream is ready to be read.  A piped character
     * stream is ready if the circular buffer is not empty.
     * @exception  IOException  If an I/O error occurs
     */
public synchronized boolean ready() throws IOException {
    if (!connected) {
        throw new IOException('Pipe not connected');
    } else if (closedByReader) {
        throw new IOException('Pipe closed');
    } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) {
        throw new IOException('Write end dead');
    }
    if (in < 0) {
        return false;
    } else {
        return true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedWriter.flush()

/**
     * Flushes this output stream and forces any buffered output characters 
     * to be written out. 
     * This will notify any readers that characters are waiting in the pipe.
     * @exception IOException if an I/O error occurs.
     */
public synchronized void flush() throws IOException {
    if (sink != null) {
        if (sink.closedByReader || closed) {
            throw new IOException('Pipe closed');
        }
        synchronized (sink) {
            sink.notifyAll();
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedOutputStream.write(byte, int, int)

/**
     * Writes <code>len</code> bytes from the specified byte array 
     * starting at offset <code>off</code> to this piped output stream. 
     * If a thread was reading data bytes from the connected piped input 
     * stream, but the thread is no longer alive, then an 
     * <code>IOException</code> is thrown.
     * @param      b     the data.
     * @param      off   the start offset in the data.
     * @param      len   the number of bytes to write.
     * @exception  IOException  if an I/O error occurs.
     */
public void write(byte b[], int off, int len) throws IOException {
    if (sink == null) {
        throw new IOException('Pipe not connected');
    } else if (b == null) {
        throw new NullPointerException();
    } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
        throw new IndexOutOfBoundsException();
    } else if (len == 0) {
        return;
    }
    sink.receive(b, off, len);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedOutputStream.write(int)

/**
     * Writes the specified <code>byte</code> to the piped output stream. 
     * If a thread was reading data bytes from the connected piped input 
     * stream, but the thread is no longer alive, then an 
     * <code>IOException</code> is thrown.
     * Implements the <code>write</code> method of <code>OutputStream</code>.
     * @param      b   the <code>byte</code> to be written.
     * @exception  IOException  if an I/O error occurs.
     */
public void write(int b) throws IOException {
    if (sink == null) {
        throw new IOException('Pipe not connected');
    }
    sink.receive(b);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedWriter.write(char, int, int)

/**
     * Writes <code>len</code> characters from the specified character array 
     * starting at offset <code>off</code> to this piped output stream. 
     * If a thread was reading data characters from the connected piped input 
     * stream, but the thread is no longer alive, then an 
     * <code>IOException</code> is thrown.
     * @param      cbuf  the data.
     * @param      off   the start offset in the data.
     * @param      len   the number of characters to write.
     * @exception  IOException  if an I/O error occurs.
     */
public void write(char cbuf[], int off, int len) throws IOException {
    if (sink == null) {
        throw new IOException('Pipe not connected');
    } else if ((off | len | (off + len) | (cbuf.length - (off + len))) < 0) {
        throw new IndexOutOfBoundsException();
    }
    sink.receive(cbuf, off, len);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PipedWriter.write(int)

/**
     * Writes the specified <code>char</code> to the piped output stream. 
     * If a thread was reading data characters from the connected piped input 
     * stream, but the thread is no longer alive, then an 
     * <code>IOException</code> is thrown.
     * Implements the <code>write</code> method of <code>Writer</code>.
     * @param      c   the <code>char</code> to be written.
     * @exception  IOException  if an I/O error occurs.
     */
public void write(int c) throws IOException {
    if (sink == null) {
        throw new IOException('Pipe not connected');
    }
    sink.receive(c);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackInputStream.unread(byte[], int, int)

/**
     * Pushes back a portion of an array of bytes by copying it to the front
     * of the pushback buffer.  After this method returns, the next byte to be
     * read will have the value <code>b[off]</code>, the byte after that will
     * have the value <code>b[off+1]</code>, and so forth.
     * @param b the byte array to push back.
     * @param off the start offset of the data.
     * @param len the number of bytes to push back.
     * @exception IOException If there is not enough room in the pushback
     *         buffer for the specified number of bytes.
     * @since     JDK1.1
     */
public void unread(byte[] b, int off, int len) throws IOException {
    ensureOpen();
    if (len > pos) {
        throw new IOException('Push back buffer is full');
    }
    pos -= len;
    System.arraycopy(b, off, buf, pos, len);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackInputStream.unread(int)

/**
     * Pushes back a byte by copying it to the front of the pushback buffer.
     * After this method returns, the next byte to be read will have the value
     * <code>(byte)b</code>.
     * @param      b   the <code>int</code> value whose low-order 
     *    byte is to be pushed back.
     * @exception IOException If there is not enough room in the pushback
     *         buffer for the byte.
     */
public void unread(int b) throws IOException {
    ensureOpen();
    if (pos == 0) {
        throw new IOException('Push back buffer is full');
    }
    buf[--pos] = (byte) b;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackReader.unread(char, int, int)

/**
     * Push back a portion of an array of characters by copying it to the
     * front of the pushback buffer.  After this method returns, the next
     * character to be read will have the value <code>cbuf[off]</code>, the
     * character after that will have the value <code>cbuf[off+1]</code>, and
     * so forth.
     * @param  cbuf  Character array
     * @param  off   Offset of first character to push back
     * @param  len   Number of characters to push back
     * @exception  IOException  If there is insufficient room in the pushback
     *                          buffer, or if some other I/O error occurs
     */
public void unread(char cbuf[], int off, int len) throws IOException {
    synchronized (lock) {
        ensureOpen();
        if (len > pos) throw new IOException('Pushback buffer overflow');
        pos -= len;
        System.arraycopy(cbuf, off, buf, pos, len);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackReader.unread(int)

/**
     * Push back a single character.
     * @param  c  The character to push back
     * @exception  IOException  If the pushback buffer is full,
     *                          or if some other I/O error occurs
     */
public void unread(int c) throws IOException {
    synchronized (lock) {
        ensureOpen();
        if (pos == 0) throw new IOException('Pushback buffer overflow');
        buf[--pos] = (char) c;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.rtf.RTFEditorKit.write(Writer, Document, int, int)

/**
     * Write content from a document to the given stream
     * as plain text.
     * @param out  The stream to write to
     * @param doc The source for the write.
     * @param pos The location in the document to fetch the
     *   content.
     * @param len The amount to write out.
     * @exception IOException on any I/O error
     * @exception BadLocationException if pos represents an invalid
     *   location within the document.
     */
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
    throw new IOException('RTF is an 8-bit format');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedInputStream.reset()

/**
     * See the general contract of the <code>reset</code>
     * method of <code>InputStream</code>.
     * If <code>markpos</code> is <code>-1</code>
     * (no mark has been set or the mark has been
     * invalidated), an <code>IOException</code>
     * is thrown. Otherwise, <code>pos</code> is
     * set equal to <code>markpos</code>.
     * @exception  IOException  if this stream has not been marked or
     *               if the mark has been invalidated.
     * @see        java.io.BufferedInputStream#mark(int)
     */
public synchronized void reset() throws IOException {
    getBufIfOpen();
    if (markpos < 0) throw new IOException('Resetting to invalid mark');
    pos = markpos;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.IIOPOutputStream.checkSpecialClasses(Object)

private boolean checkSpecialClasses(Object obj) throws IOException {
    if (obj instanceof ObjectStreamClass) {
        throw new IOException('Serialization of ObjectStreamClass not supported');
    }
    return false;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.PlainSocketImpl.getInputStream()

/**
     * Gets an InputStream for this socket.
     */
protected synchronized InputStream getInputStream() throws IOException {
    if (isClosedOrPending()) {
        throw new IOException('Socket Closed');
    }
    if (shut_rd) {
        throw new IOException('Socket input is shutdown');
    }
    if (socketInputStream == null) {
        socketInputStream = new SocketInputStream(this);
    }
    return socketInputStream;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.PlainSocketImpl.getOutputStream()

/**
     * Gets an OutputStream for this socket.
     */
protected synchronized OutputStream getOutputStream() throws IOException {
    if (isClosedOrPending()) {
        throw new IOException('Socket Closed');
    }
    if (shut_wr) {
        throw new IOException('Socket output is shutdown');
    }
    return new SocketOutputStream(this);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.PlainSocketImpl.sendUrgentData(int)

protected void sendUrgentData(int data) throws IOException {
    if (fd == null) {
        throw new IOException('Socket Closed');
    }
    socketSendUrgentData(data);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedInputStream.fill()

/**
     * Fills the buffer with more data, taking into account
     * shuffling and other tricks for dealing with marks.
     * Assumes that it is being called by a synchronized method.
     * This method also assumes that all data has already been read in,
     * hence pos > count.
     */
private void fill() throws IOException {
    byte[] buffer = getBufIfOpen();
    if (markpos < 0) pos = 0; else if (pos >= buffer.length) if (markpos > 0) {
        int sz = pos - markpos;
        System.arraycopy(buffer, markpos, buffer, 0, sz);
        pos = sz;
        markpos = 0;
    } else if (buffer.length >= marklimit) {
        markpos = -1;
        pos = 0;
    } else {
        int nsz = pos * 2;
        if (nsz > marklimit) nsz = marklimit;
        byte nbuf[] = new byte[nsz];
        System.arraycopy(buffer, 0, nbuf, 0, pos);
        if (!bufUpdater.compareAndSet(this, buffer, nbuf)) {
            throw new IOException('Stream closed');
        }
        buffer = nbuf;
    }
    count = pos;
    int n = getInIfOpen().read(buffer, pos, buffer.length - pos);
    if (n > 0) count = n + pos;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedInputStream.getBufIfOpen()

/**
     * Check to make sure that buffer has not been nulled out due to
     * close; if not return it;
     */
private byte[] getBufIfOpen() throws IOException {
    byte[] buffer = buf;
    if (buffer == null) throw new IOException('Stream closed');
    return buffer;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedInputStream.getInIfOpen()

/**
     * Check to make sure that underlying input stream has not been
     * nulled out due to close; if not return it;
     */
private InputStream getInIfOpen() throws IOException {
    InputStream input = in;
    if (input == null) throw new IOException('Stream closed');
    return input;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedReader.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (in == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.BufferedWriter.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (out == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.CharArrayReader.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (buf == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PrintStream.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (out == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PrintWriter.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (out == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackInputStream.ensureOpen()

/**
     * Check to make sure that this stream has not been closed
     */
private void ensureOpen() throws IOException {
    if (in == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackReader.ensureOpen()

/** Check to make sure that the stream has not been closed. */
private void ensureOpen() throws IOException {
    if (buf == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.StringReader.ensureOpen()

/** Check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
    if (str == null) throw new IOException('Stream closed');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.GZIPInputStream.ensureOpen()

/**
     * Check to make sure that this stream has not been closed
     */
private void ensureOpen() throws IOException {
    if (closed) {
        throw new IOException('Stream closed');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.InflaterInputStream.ensureOpen()

/**
     * Check to make sure that this stream has not been closed
     */
private void ensureOpen() throws IOException {
    if (closed) {
        throw new IOException('Stream closed');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.ZipInputStream.ensureOpen()

/**
     * Check to make sure that this stream has not been closed
     */
private void ensureOpen() throws IOException {
    if (closed) {
        throw new IOException('Stream closed');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.ZipOutputStream.ensureOpen()

/**
     * Check to make sure that this stream has not been closed
     */
private void ensureOpen() throws IOException {
    if (closed) {
        throw new IOException('Stream closed');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.PlainSocketImpl.available()

/**
     * Returns the number of bytes that can be read without blocking.
     */
protected synchronized int available() throws IOException {
    if (isClosedOrPending()) {
        throw new IOException('Stream closed.');
    }
    if (isConnectionReset()) {
        return 0;
    }
    int n = 0;
    try {
        n = socketAvailable();
        if (n == 0 && isConnectionResetPending()) {
            setConnectionReset();
        }
    } catch (ConnectionResetException exc1) {
        setConnectionResetPending();
        try {
            n = socketAvailable();
            if (n == 0) {
                setConnectionReset();
            }
        } catch (ConnectionResetException exc2) {
        }
    }
    return n;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.internal.ClientNotifForwarder.beforeRemove()

/**
     * Import: should not remove a listener dureing reconnection, the reconnection
     * needs to change the listener list and that will possibly make removal fail.
     */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException('Terminated.');
        }
        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);
            throw ioe;
        }
    }
    if (state == TERMINATED) {
        throw new IOException('Terminated.');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.internal.ClientNotifForwarder.init(boolean)

private synchronized void init(boolean reconnected) throws IOException {
    switch(state) {
        case STARTED:
            return;
        case STARTING:
            return;
        case TERMINATED:
            throw new IOException('The ClientNotifForwarder has been terminated.');
        case STOPPING:
            if (beingReconnected == true) {
                return;
            }
            while (state == STOPPING) {
                try {
                    wait();
                } catch (InterruptedException ire) {
                    IOException ioe = new IOException(ire.toString());
                    EnvHelp.initCause(ioe, ire);
                    throw ioe;
                }
            }
            init(reconnected);
            return;
        case STOPPED:
            if (beingReconnected == true) {
                return;
            }
            if (logger.traceOn()) {
                logger.trace('init', 'Initializing...');
            }
            if (!reconnected) {
                try {
                    NotificationResult nr = fetchNotifs(-1, 0, 0);
                    clientSequenceNumber = nr.getNextSequenceNumber();
                } catch (ClassNotFoundException e) {
                    logger.warning('init', 'Impossible exception: ' + e);
                    logger.debug('init', e);
                }
            }
            try {
                mbeanRemovedNotifID = addListenerForMBeanRemovedNotif();
            } catch (Exception e) {
                final String msg = 'Failed to register a listener to the mbean ' + 'server: the client will not do clean when an MBean ' + 'is unregistered';
                if (logger.traceOn()) {
                    logger.trace('init', msg, e);
                }
            }
            setState(STARTING);
            executor.execute(new NotifFetcher());
            return;
        default:
            throw new IOException('Unknown state.');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.internal.ClientCommunicatorAdmin.restart(IOException)

private void restart(IOException ioe) throws IOException {
    synchronized (lock) {
        if (state == TERMINATED) {
            throw new IOException('The client has been closed.');
        } else if (state == FAILED) {
            throw ioe;
        } else if (state == RE_CONNECTING) {
            while (state == RE_CONNECTING) {
                try {
                    lock.wait();
                } catch (InterruptedException ire) {
                    InterruptedIOException iioe = new InterruptedIOException(ire.toString());
                    EnvHelp.initCause(iioe, ire);
                    throw iioe;
                }
            }
            if (state == TERMINATED) {
                throw new IOException('The client has been closed.');
            } else if (state != CONNECTED) {
                throw ioe;
            }
        } else {
            state = RE_CONNECTING;
            lock.notifyAll();
        }
    }
    try {
        doStart();
        synchronized (lock) {
            if (state == TERMINATED) {
                throw new IOException('The client has been closed.');
            }
            state = CONNECTED;
            lock.notifyAll();
        }
        return;
    } catch (Exception e) {
        logger.warning('restart', 'Failed to restart: ' + e);
        logger.debug('restart', e);
        synchronized (lock) {
            if (state == TERMINATED) {
                throw new IOException('The client has been closed.');
            }
            state = FAILED;
            lock.notifyAll();
        }
        try {
            doStop();
        } catch (Exception eee) {
        }
        terminate();
        throw ioe;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.remote.internal.ServerNotifForwarder.checkState()

private void checkState() throws IOException {
    synchronized (terminationLock) {
        if (terminated) {
            throw new IOException('The connection has been terminated.');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.remote.rmi.RMIConnectorServer.start()

/**
     * Activates the connector server, that is starts listening for
     * client connections.  Calling this method when the connector
     * server is already active has no effect.  Calling this method
     * when the connector server has been stopped will generate an
     * <code>IOException</code>.
     * The behaviour of this method when called for the first time
     * depends on the parameters that were supplied at construction,
     * as described below.
     * First, an object of a subclass of {@link RMIServerImpl} is
     * required, to export the connector server through RMI:
     * <ul>
     * <li>If an <code>RMIServerImpl</code> was supplied to the
     * constructor, it is used.
     * <li>Otherwise, if the protocol part of the
     * <code>JMXServiceURL</code> supplied to the constructor was
     * <code>iiop</code>, an object of type {@link RMIIIOPServerImpl}
     * is created.
     * <li>Otherwise, if the <code>JMXServiceURL</code>
     * was null, or its protocol part was <code>rmi</code>, an object
     * of type {@link RMIJRMPServerImpl} is created.
     * <li>Otherwise, the implementation can create an
     * implementation-specific {@link RMIServerImpl} or it can throw
     * {@link MalformedURLException}.
     * </ul>
     * If the given address includes a JNDI directory URL as
     * specified in the package documentation for {@link
     * javax.management.remote.rmi}, then this
     * <code>RMIConnectorServer</code> will bootstrap by binding the
     * <code>RMIServerImpl</code> to the given address.
     * If the URL path part of the <code>JMXServiceURL</code> was
     * empty or a single slash (<code>/</code>), then the RMI object
     * will not be bound to a directory.  Instead, a reference to it
     * will be encoded in the URL path of the RMIConnectorServer
     * address (returned by {@link #getAddress()}).  The encodings for
     * <code>rmi</code> and <code>iiop</code> are described in the
     * package documentation for {@link
     * javax.management.remote.rmi}.
     * The behavior when the URL path is neither empty nor a JNDI
     * directory URL, or when the protocol is neither <code>rmi</code>
     * nor <code>iiop</code>, is implementation defined, and may
     * include throwing {@link MalformedURLException} when the
     * connector server is created or when it is started.
     * @exception IllegalStateException if the connector server has
     * not been attached to an MBean server.
     * @exception IOException if the connector server cannot be
     * started.
     */
public synchronized void start() throws IOException {
    final boolean tracing = logger.traceOn();
    if (state == STARTED) {
        if (tracing) logger.trace('start', 'already started');
        return;
    } else if (state == STOPPED) {
        if (tracing) logger.trace('start', 'already stopped');
        throw new IOException('The server has been stopped.');
    }
    MBeanServer mbs = getMBeanServer();
    if (mbs == null) throw new IllegalStateException('This connector server is not ' + 'attached to an MBean server');
    if (attributes != null) {
        String accessFile = (String) attributes.get('jmx.remote.x.access.file');
        if (accessFile != null) {
            MBeanServerForwarder mbsf = null;
            try {
                mbsf = new MBeanServerFileAccessController(accessFile);
            } catch (IOException e) {
                throw (IllegalArgumentException) EnvHelp.initCause(new IllegalArgumentException(e.getMessage()), e);
            }
            setMBeanServerForwarder(mbsf);
            mbs = getMBeanServer();
        }
    }
    try {
        if (tracing) logger.trace('start', 'setting default class loader');
        defaultClassLoader = EnvHelp.resolveServerClassLoader(attributes, mbs);
    } catch (InstanceNotFoundException infc) {
        IllegalArgumentException x = new IllegalArgumentException('ClassLoader not found: ' + infc);
        throw (IllegalArgumentException) EnvHelp.initCause(x, infc);
    }
    if (tracing) logger.trace('start', 'setting RMIServer object');
    final RMIServerImpl rmiServer;
    if (rmiServerImpl != null) rmiServer = rmiServerImpl; else rmiServer = newServer();
    rmiServer.setMBeanServer(mbs);
    rmiServer.setDefaultClassLoader(defaultClassLoader);
    rmiServer.setRMIConnectorServer(this);
    rmiServer.export();
    try {
        if (tracing) logger.trace('start', 'getting RMIServer object to export');
        final RMIServer objref = objectToBind(rmiServer, attributes);
        if (address != null && address.getURLPath().startsWith('/jndi/')) {
            final String jndiUrl = address.getURLPath().substring(6);
            if (tracing) logger.trace('start', 'Using external directory: ' + jndiUrl);
            final boolean rebind;
            String rebindS = (String) attributes.get(JNDI_REBIND_ATTRIBUTE);
            if (rebindS == null) rebind = false; else if (rebindS.equalsIgnoreCase('true')) rebind = true; else if (rebindS.equalsIgnoreCase('false')) rebind = false; else throw new IllegalArgumentException(JNDI_REBIND_ATTRIBUTE + 'must' + ' be \'true\' or \'false\'');
            if (tracing) logger.trace('start', JNDI_REBIND_ATTRIBUTE + '=' + rebind);
            try {
                if (tracing) logger.trace('start', 'binding to ' + jndiUrl);
                final Hashtable usemap = EnvHelp.mapToHashtable(attributes);
                final boolean isIiop = isIiopURL(address, true);
                if (isIiop) {
                    usemap.put(EnvHelp.DEFAULT_ORB, RMIConnector.resolveOrb(attributes));
                }
                bind(jndiUrl, usemap, objref, rebind);
                boundJndiUrl = jndiUrl;
            } catch (NamingException e) {
                throw newIOException('Cannot bind to URL [' + jndiUrl + ']: ' + e, e);
            }
        } else {
            if (tracing) logger.trace('start', 'Encoding URL');
            encodeStubInAddress(objref, attributes);
            if (tracing) logger.trace('start', 'Encoded URL: ' + this.address);
        }
    } catch (Exception e) {
        try {
            rmiServer.close();
        } catch (Exception x) {
        }
        if (e instanceof RuntimeException) throw (RuntimeException) e; else if (e instanceof IOException) throw (IOException) e; else throw newIOException('Got unexpected exception while ' + 'starting the connector server: ' + e, e);
    }
    rmiServerImpl = rmiServer;
    synchronized (openedServers) {
        openedServers.add(this);
    }
    state = STARTED;
    if (tracing) {
        logger.trace('start', 'Connector Server Address = ' + address);
        logger.trace('start', 'started.');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.trax.DOM2SAX.parse(String)

/**
     * This class is only used internally so this method should never 
     * be called.
     */
public void parse(String sysId) throws IOException, SAXException {
    throw new IOException('This method is not yet implemented.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(String)

/**
     * This class is only used internally so this method should never 
     * be called.
     */
public void parse(String sysId) throws IOException, SAXException {
    throw new IOException('This method is not yet implemented.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.rtf.RTFParser.write(char)

public void write(char ch) throws IOException {
    boolean ok;
    switch(state) {
        case S_text:
            if (ch == '\n' || ch == '\r') {
                break;
            } else if (ch == '{') {
                if (currentCharacters.length() > 0) {
                    handleText(currentCharacters.toString());
                    currentCharacters = new StringBuffer();
                }
                level++;
                begingroup();
            } else if (ch == '}') {
                if (currentCharacters.length() > 0) {
                    handleText(currentCharacters.toString());
                    currentCharacters = new StringBuffer();
                }
                if (level == 0) throw new IOException('Too many close-groups in RTF text');
                endgroup();
                level--;
            } else if (ch == '\\') {
                if (currentCharacters.length() > 0) {
                    handleText(currentCharacters.toString());
                    currentCharacters = new StringBuffer();
                }
                state = S_backslashed;
            } else {
                currentCharacters.append(ch);
            }
            break;
        case S_backslashed:
            if (ch == '\'') {
                state = S_aftertick;
                break;
            }
            if (!Character.isLetter(ch)) {
                char newstring[] = new char[1];
                newstring[0] = ch;
                if (!handleKeyword(new String(newstring))) {
                    warning('Unknown keyword: ' + newstring + ' (' + (byte) ch + ')');
                }
                state = S_text;
                pendingKeyword = null;
                break;
            }
            state = S_token;
        case S_token:
            if (Character.isLetter(ch)) {
                currentCharacters.append(ch);
            } else {
                pendingKeyword = currentCharacters.toString();
                currentCharacters = new StringBuffer();
                if (Character.isDigit(ch) || (ch == '-')) {
                    state = S_parameter;
                    currentCharacters.append(ch);
                } else {
                    ok = handleKeyword(pendingKeyword);
                    if (!ok) warning('Unknown keyword: ' + pendingKeyword);
                    pendingKeyword = null;
                    state = S_text;
                    if (!Character.isWhitespace(ch)) write(ch);
                }
            }
            break;
        case S_parameter:
            if (Character.isDigit(ch)) {
                currentCharacters.append(ch);
            } else {
                if (pendingKeyword.equals('bin')) {
                    long parameter = Long.parseLong(currentCharacters.toString());
                    pendingKeyword = null;
                    state = S_inblob;
                    binaryBytesLeft = parameter;
                    if (binaryBytesLeft > Integer.MAX_VALUE) binaryBuf = new ByteArrayOutputStream(Integer.MAX_VALUE); else binaryBuf = new ByteArrayOutputStream((int) binaryBytesLeft);
                    savedSpecials = specialsTable;
                    specialsTable = allSpecialsTable;
                    break;
                }
                int parameter = Integer.parseInt(currentCharacters.toString());
                ok = handleKeyword(pendingKeyword, parameter);
                if (!ok) warning('Unknown keyword: ' + pendingKeyword + ' (param ' + currentCharacters + ')');
                pendingKeyword = null;
                currentCharacters = new StringBuffer();
                state = S_text;
                if (!Character.isWhitespace(ch)) write(ch);
            }
            break;
        case S_aftertick:
            if (Character.digit(ch, 16) == -1) state = S_text; else {
                pendingCharacter = Character.digit(ch, 16);
                state = S_aftertickc;
            }
            break;
        case S_aftertickc:
            state = S_text;
            if (Character.digit(ch, 16) != -1) {
                pendingCharacter = pendingCharacter * 16 + Character.digit(ch, 16);
                ch = translationTable[pendingCharacter];
                if (ch != 0) handleText(ch);
            }
            break;
        case S_inblob:
            binaryBuf.write(ch);
            binaryBytesLeft--;
            if (binaryBytesLeft == 0) {
                state = S_text;
                specialsTable = savedSpecials;
                savedSpecials = null;
                handleBinaryBlob(binaryBuf.toByteArray());
                binaryBuf = null;
            }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.rtf.RTFReader.readCharset(InputStream)

/** Parses a character set from an InputStream. The character set
 * must contain 256 decimal integers, separated by whitespace, with
 * no punctuation. B- and C- style comments are allowed.
 * @returns the newly read character set
 */
static char[] readCharset(InputStream strm) throws IOException {
    char[] values = new char[256];
    int i;
    StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(strm, 'ISO-8859-1')));
    in.eolIsSignificant(false);
    in.commentChar('#');
    in.slashSlashComments(true);
    in.slashStarComments(true);
    i = 0;
    while (i < 256) {
        int ttype;
        try {
            ttype = in.nextToken();
        } catch (Exception e) {
            throw new IOException('Unable to read from character set file (' + e + ')');
        }
        if (ttype != in.TT_NUMBER) {
            throw new IOException('Unexpected token in character set file');
        }
        values[i] = (char) (in.nval);
        i++;
    }
    return values;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.AlgorithmParameters.init(byte[])

/**
     * Imports the specified parameters and decodes them according to the 
     * primary decoding format for parameters. The primary decoding
     * format for parameters is ASN.1, if an ASN.1 specification for this type
     * of parameters exists.
     * @param params the encoded parameters.
     * @exception IOException on decoding errors, or if this parameter object
     * has already been initialized.
     */
public final void init(byte[] params) throws IOException {
    if (this.initialized) throw new IOException('already initialized');
    paramSpi.engineInit(params);
    this.initialized = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.AlgorithmParameters.init(byte[], String)

/**
     * Imports the parameters from <code>params</code> and decodes them 
     * according to the specified decoding scheme.
     * If <code>format</code> is null, the
     * primary decoding format for parameters is used. The primary decoding
     * format is ASN.1, if an ASN.1 specification for these parameters
     * exists.
     * @param params the encoded parameters.
     * @param format the name of the decoding scheme.
     * @exception IOException on decoding errors, or if this parameter object
     * has already been initialized.
     */
public final void init(byte[] params, String format) throws IOException {
    if (this.initialized) throw new IOException('already initialized');
    paramSpi.engineInit(params, format);
    this.initialized = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.parser.DTD.readContentModel(DataInputStream, String[])

private ContentModel readContentModel(DataInputStream in, String[] names) throws IOException {
    byte flag = in.readByte();
    switch(flag) {
        case 0:
            return null;
        case 1:
            {
                int type = in.readByte();
                ContentModel m = readContentModel(in, names);
                ContentModel next = readContentModel(in, names);
                return defContentModel(type, m, next);
            }
        case 2:
            {
                int type = in.readByte();
                Element el = getElement(names[in.readShort()]);
                ContentModel next = readContentModel(in, names);
                return defContentModel(type, el, next);
            }
        default:
            throw new IOException('bad bdtd');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.logging.FileHandler.generate(String, int, int)

private File generate(String pattern, int generation, int unique) throws IOException {
    File file = null;
    String word = '';
    int ix = 0;
    boolean sawg = false;
    boolean sawu = false;
    while (ix < pattern.length()) {
        char ch = pattern.charAt(ix);
        ix++;
        char ch2 = 0;
        if (ix < pattern.length()) {
            ch2 = Character.toLowerCase(pattern.charAt(ix));
        }
        if (ch == '/') {
            if (file == null) {
                file = new File(word);
            } else {
                file = new File(file, word);
            }
            word = '';
            continue;
        } else if (ch == '%') {
            if (ch2 == 't') {
                String tmpDir = System.getProperty('java.io.tmpdir');
                if (tmpDir == null) {
                    tmpDir = System.getProperty('user.home');
                }
                file = new File(tmpDir);
                ix++;
                word = '';
                continue;
            } else if (ch2 == 'h') {
                file = new File(System.getProperty('user.home'));
                if (isSetUID()) {
                    throw new IOException('can't use %h in set UID program');
                }
                ix++;
                word = '';
                continue;
            } else if (ch2 == 'g') {
                word = word + generation;
                sawg = true;
                ix++;
                continue;
            } else if (ch2 == 'u') {
                word = word + unique;
                sawu = true;
                ix++;
                continue;
            } else if (ch2 == '%') {
                word = word + '%';
                ix++;
                continue;
            }
        }
        word = word + ch;
    }
    if (count > 1 && !sawg) {
        word = word + '.' + generation;
    }
    if (unique > 0 && !sawu) {
        word = word + '.' + unique;
    }
    if (word.length() > 0) {
        if (file == null) {
            file = new File(word);
        } else {
            file = new File(file, word);
        }
    }
    return file;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.sound.sampled.AudioInputStream.read()

/**
     * Reads the next byte of data from the audio input stream.  The audio input
     * stream's frame size must be one byte, or an <code>IOException</code>
     * will be thrown.
     * @return the next byte of data, or -1 if the end of the stream is reached
     * @throws IOException if an input or output error occurs
     * @see #read(byte[], int, int)
     * @see #read(byte[])
     * @see #available
     */
public int read() throws IOException {
    if (frameSize != 1) {
        throw new IOException('cannot read a single byte if frame size > 1');
    }
    byte[] data = new byte[1];
    int temp = read(data);
    if (temp <= 0) {
        return -1;
    }
    return temp & 0xFF;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.imageio.stream.ImageInputStreamImpl.checkClosed()

/**
     * Throws an <code>IOException</code> if the stream has been closed.
     * Subclasses may call this method from any of their methods that
     * require the stream not to be closed.
     * @exception IOException if the stream is closed.
     */
protected final void checkClosed() throws IOException {
    if (isClosed) {
        throw new IOException('closed');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.ImageIcon.writeObject(ObjectOutputStream)

private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    int w = getIconWidth();
    int h = getIconHeight();
    int[] pixels = image != null ? new int[w * h] : null;
    if (image != null) {
        try {
            PixelGrabber pg = new PixelGrabber(image, 0, 0, w, h, pixels, 0, w);
            pg.grabPixels();
            if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
                throw new IOException('failed to load image contents');
            }
        } catch (InterruptedException e) {
            throw new IOException('image load interrupted');
        }
    }
    s.writeInt(w);
    s.writeInt(h);
    s.writeObject(pixels);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.jar.Attributes.read(Manifest.FastInputStream, byte[])

void read(Manifest.FastInputStream is, byte[] lbuf) throws IOException {
    String name = null, value = null;
    byte[] lastline = null;
    int len;
    while ((len = is.readLine(lbuf)) != -1) {
        boolean lineContinued = false;
        if (lbuf[--len] != '\n') {
            throw new IOException('line too long');
        }
        if (len > 0 && lbuf[len - 1] == '\r') {
            --len;
        }
        if (len == 0) {
            break;
        }
        int i = 0;
        if (lbuf[0] == ' ') {
            if (name == null) {
                throw new IOException('misplaced continuation line');
            }
            lineContinued = true;
            byte[] buf = new byte[lastline.length + len - 1];
            System.arraycopy(lastline, 0, buf, 0, lastline.length);
            System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
            if (is.peek() == ' ') {
                lastline = buf;
                continue;
            }
            value = new String(buf, 0, buf.length, 'UTF8');
            lastline = null;
        } else {
            while (lbuf[i++] != ':') {
                if (i >= len) {
                    throw new IOException('invalid header field');
                }
            }
            if (lbuf[i++] != ' ') {
                throw new IOException('invalid header field');
            }
            name = new String(lbuf, 0, 0, i - 2);
            if (is.peek() == ' ') {
                lastline = new byte[len - i];
                System.arraycopy(lbuf, i, lastline, 0, len - i);
                continue;
            }
            value = new String(lbuf, i, len - i, 'UTF8');
        }
        try {
            if ((putValue(name, value) != null) && (!lineContinued)) {
                Logger.getLogger('java.util.jar').warning('Duplicate name in Manifest: ' + name);
            }
        } catch (IllegalArgumentException e) {
            throw new IOException('invalid header field name: ' + name);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.cert.X509CertSelector.matchSubjectPublicKeyAlgID(X509Certificate)

private boolean matchSubjectPublicKeyAlgID(X509Certificate xcert) {
    if (subjectPublicKeyAlgID == null) {
        return true;
    }
    try {
        byte[] encodedKey = xcert.getPublicKey().getEncoded();
        DerValue val = new DerValue(encodedKey);
        if (val.tag != DerValue.tag_Sequence) {
            throw new IOException('invalid key format');
        }
        AlgorithmId algID = AlgorithmId.parse(val.data.getDerValue());
        if (debug != null) {
            debug.println('X509CertSelector.match: subjectPublicKeyAlgID = ' + subjectPublicKeyAlgID + ', xcert subjectPublicKeyAlgID = ' + algID.getOID());
        }
        if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
            if (debug != null) {
                debug.println('X509CertSelector.match: ' + 'subject public key alg IDs don't match');
            }
            return false;
        }
    } catch (IOException e5) {
        if (debug != null) {
            debug.println('X509CertSelector.match: IOException in subject ' + 'public key algorithm OID check');
        }
        return false;
    }
    return true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.jar.Manifest.read(InputStream)

/**
     * Reads the Manifest from the specified InputStream. The entry
     * names and attributes read will be merged in with the current
     * manifest entries.
     * @param is the input stream
     * @exception IOException if an I/O error has occurred
     */
public void read(InputStream is) throws IOException {
    FastInputStream fis = new FastInputStream(is);
    byte[] lbuf = new byte[512];
    attr.read(fis, lbuf);
    int ecount = 0, acount = 0;
    int asize = 2;
    int len;
    String name = null;
    boolean skipEmptyLines = true;
    byte[] lastline = null;
    while ((len = fis.readLine(lbuf)) != -1) {
        if (lbuf[--len] != '\n') {
            throw new IOException('manifest line too long');
        }
        if (len > 0 && lbuf[len - 1] == '\r') {
            --len;
        }
        if (len == 0 && skipEmptyLines) {
            continue;
        }
        skipEmptyLines = false;
        if (name == null) {
            name = parseName(lbuf, len);
            if (name == null) {
                throw new IOException('invalid manifest format');
            }
            if (fis.peek() == ' ') {
                lastline = new byte[len - 6];
                System.arraycopy(lbuf, 6, lastline, 0, len - 6);
                continue;
            }
        } else {
            byte[] buf = new byte[lastline.length + len - 1];
            System.arraycopy(lastline, 0, buf, 0, lastline.length);
            System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
            if (fis.peek() == ' ') {
                lastline = buf;
                continue;
            }
            name = new String(buf, 0, buf.length, 'UTF8');
            lastline = null;
        }
        Attributes attr = getAttributes(name);
        if (attr == null) {
            attr = new Attributes(asize);
            entries.put(name, attr);
        }
        attr.read(fis, lbuf);
        ecount++;
        acount += attr.size();
        asize = Math.max(2, acount / ecount);
        name = null;
        skipEmptyLines = true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JEditorPane.setPage(String)

/**
     * Sets the current URL being displayed.
     * @param url the URL for display
     * @exception IOException for a <code>null</code> or invalid URL
     *  specification
     */
public void setPage(String url) throws IOException {
    if (url == null) {
        throw new IOException('invalid url');
    }
    URL page = new URL(url);
    setPage(page);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JEditorPane.setPage(URL)

/**
     * Sets the current URL being displayed.  The content type of the
     * pane is set, and if the editor kit for the pane is
     * non-<code>null</code>, then
     * a new default document is created and the URL is read into it.
     * If the URL contains and reference location, the location will
     * be scrolled to by calling the <code>scrollToReference</code> 
     * method. If the desired URL is the one currently being displayed, 
     * the document will not be reloaded. To force a document
     * reload it is necessary to clear the stream description property 
     * of the document. The following code shows how this can be done:
     * 
     *   Document doc = jEditorPane.getDocument();
     *   doc.putProperty(Document.StreamDescriptionProperty, null);
     * 
     * If the desired URL is not the one currently being
     * displayed, the <code>getStream</code> method is called to
     * give subclasses control over the stream provided.
     * This may load either synchronously or asynchronously
     * depending upon the document returned by the <code>EditorKit</code>.
     * If the <code>Document</code> is of type
     * <code>AbstractDocument</code> and has a value returned by 
     * <code>AbstractDocument.getAsynchronousLoadPriority</code>
     * that is greater than or equal to zero, the page will be
     * loaded on a separate thread using that priority.
     * If the document is loaded synchronously, it will be
     * filled in with the stream prior to being installed into
     * the editor with a call to <code>setDocument</code>, which
     * is bound and will fire a property change event.  If an
     * <code>IOException</code> is thrown the partially loaded
     * document will
     * be discarded and neither the document or page property
     * change events will be fired.  If the document is 
     * successfully loaded and installed, a view will be
     * built for it by the UI which will then be scrolled if 
     * necessary, and then the page property change event
     * will be fired.
     * If the document is loaded asynchronously, the document
     * will be installed into the editor immediately using a
     * call to <code>setDocument</code> which will fire a 
     * document property change event, then a thread will be
     * created which will begin doing the actual loading.  
     * In this case, the page property change event will not be 
     * fired by the call to this method directly, but rather will be 
     * fired when the thread doing the loading has finished.
     * It will also be fired on the event-dispatch thread.
     * Since the calling thread can not throw an <code>IOException</code>
     * in the event of failure on the other thread, the page 
     * property change event will be fired when the other 
     * thread is done whether the load was successful or not.
     * @param page the URL of the page
     * @exception IOException for a <code>null</code> or invalid
     *  page specification, or exception from the stream being read
     * @see #getPage
     * @beaninfo
     *  description: the URL used to set content
     *        bound: true
     *       expert: true
     */
public void setPage(URL page) throws IOException {
    if (page == null) {
        throw new IOException('invalid url');
    }
    URL loaded = getPage();
    if (!page.equals(loaded) && page.getRef() == null) {
        scrollRectToVisible(new Rectangle(0, 0, 1, 1));
    }
    boolean reloaded = false;
    if ((loaded == null) || (!loaded.sameFile(page))) {
        InputStream in = getStream(page);
        if (kit != null) {
            Document doc = kit.createDefaultDocument();
            if (pageProperties != null) {
                for (Enumeration e = pageProperties.keys(); e.hasMoreElements(); ) {
                    Object key = e.nextElement();
                    doc.putProperty(key, pageProperties.get(key));
                }
                pageProperties.clear();
            }
            if (doc.getProperty(Document.StreamDescriptionProperty) == null) {
                doc.putProperty(Document.StreamDescriptionProperty, page);
            }
            synchronized (this) {
                if (loading != null) {
                    loading.cancel();
                    loading = null;
                }
            }
            if (doc instanceof AbstractDocument) {
                AbstractDocument adoc = (AbstractDocument) doc;
                int p = adoc.getAsynchronousLoadPriority();
                if (p >= 0) {
                    setDocument(doc);
                    synchronized (this) {
                        loading = new PageStream(in);
                        Thread pl = new PageLoader(doc, loading, p, loaded, page);
                        pl.start();
                    }
                    return;
                }
            }
            read(in, doc);
            setDocument(doc);
            reloaded = true;
        }
    }
    final String reference = page.getRef();
    if (reference != null) {
        if (!reloaded) {
            scrollToReference(reference);
        } else {
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    scrollToReference(reference);
                }
            });
        }
        getDocument().putProperty(Document.StreamDescriptionProperty, page);
    }
    firePropertyChange('page', loaded, page);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.Reader.mark(int)

/**
     * Mark the present position in the stream.  Subsequent calls to reset()
     * will attempt to reposition the stream to this point.  Not all
     * character-input streams support the mark() operation.
     * @param  readAheadLimit  Limit on the number of characters that may be
     *                         read while still preserving the mark.  After
     *                         reading this many characters, attempting to
     *                         reset the stream may fail.
     * @exception  IOException  If the stream does not support mark(),
     *                          or if some other I/O error occurs
     */
public void mark(int readAheadLimit) throws IOException {
    throw new IOException('mark() not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.InputStream.reset()

/**
     * Repositions this stream to the position at the time the
     * <code>mark</code> method was last called on this input stream.
     *  The general contract of <code>reset</code> is:
     * <ul>
     * <li> If the method <code>markSupported</code> returns
     * <code>true</code>, then:
     *     <ul><li> If the method <code>mark</code> has not been called since
     *     the stream was created, or the number of bytes read from the stream
     *     since <code>mark</code> was last called is larger than the argument
     *     to <code>mark</code> at that last call, then an
     *     <code>IOException</code> might be thrown.
     *     <li> If such an <code>IOException</code> is not thrown, then the
     *     stream is reset to a state such that all the bytes read since the
     *     most recent call to <code>mark</code> (or since the start of the
     *     file, if <code>mark</code> has not been called) will be resupplied
     *     to subsequent callers of the <code>read</code> method, followed by
     *     any bytes that otherwise would have been the next input data as of
     *     the time of the call to <code>reset</code>. </ul>
     * <li> If the method <code>markSupported</code> returns
     * <code>false</code>, then:
     *     <ul><li> The call to <code>reset</code> may throw an
     *     <code>IOException</code>.
     *     <li> If an <code>IOException</code> is not thrown, then the stream
     *     is reset to a fixed state that depends on the particular type of the
     *     input stream and how it was created. The bytes that will be supplied
     *     to subsequent callers of the <code>read</code> method depend on the
     *     particular type of the input stream. </ul></ul>
     * The method <code>reset</code> for class <code>InputStream</code>
     * does nothing except throw an <code>IOException</code>.
     * @exception  IOException  if this stream has not been marked or if the
     *               mark has been invalidated.
     * @see     java.io.InputStream#mark(int)
     * @see     java.io.IOException
     */
public synchronized void reset() throws IOException {
    throw new IOException('mark/reset not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackInputStream.reset()

/**
     * Repositions this stream to the position at the time the
     * <code>mark</code> method was last called on this input stream.
     *  The method <code>reset</code> for class
     * <code>PushbackInputStream</code> does nothing except throw an
     * <code>IOException</code>.
     * @exception  IOException  if this method is invoked.
     * @see     java.io.InputStream#mark(int)
     * @see     java.io.IOException
     */
public synchronized void reset() throws IOException {
    throw new IOException('mark/reset not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackReader.mark(int)

/**
     * Mark the present position in the stream. The <code>mark</code>
     * for class <code>PushbackReader</code> always throws an exception.
     * @exception  IOException  Always, since mark is not supported
     */
public void mark(int readAheadLimit) throws IOException {
    throw new IOException('mark/reset not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.PushbackReader.reset()

/**
     * Reset the stream. The <code>reset</code> method of 
     * <code>PushbackReader</code> always throws an exception.
     * @exception  IOException  Always, since reset is not supported
     */
public void reset() throws IOException {
    throw new IOException('mark/reset not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.InflaterInputStream.reset()

/**
     * Repositions this stream to the position at the time the
     * <code>mark</code> method was last called on this input stream.
     *  The method <code>reset</code> for class
     * <code>InflaterInputStream</code> does nothing except throw an
     * <code>IOException</code>.
     * @exception  IOException  if this method is invoked.
     * @see     java.io.InputStream#mark(int)
     * @see     java.io.IOException
     */
public synchronized void reset() throws IOException {
    throw new IOException('mark/reset not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.cert.X509CertSelector.makeGeneralNameInterface(int, Object)

/**
     * Make a <code>GeneralNameInterface</code> out of a name type (0-8) and an
     * Object that may be a byte array holding the ASN.1 DER encoded
     * name or a String form of the name.  Except for X.509
     * Distinguished Names, the String form of the name must not be the
     * result from calling toString on an existing GeneralNameInterface
     * implementing class.  The output of toString is not compatible
     * with the String constructors for names other than Distinguished
     * Names.
     * @param type name type (0-8)
     * @param name name as ASN.1 Der-encoded byte array or String
     * @return a GeneralNameInterface name
     * @throws IOException if a parsing error occurs
     */
static GeneralNameInterface makeGeneralNameInterface(int type, Object name) throws IOException {
    GeneralNameInterface result;
    if (debug != null) {
        debug.println('X509CertSelector.makeGeneralNameInterface(' + type + ')...');
    }
    if (name instanceof String) {
        if (debug != null) {
            debug.println('X509CertSelector.makeGeneralNameInterface() ' + 'name is String: ' + name);
        }
        switch(type) {
            case NAME_RFC822:
                result = new RFC822Name((String) name);
                break;
            case NAME_DNS:
                result = new DNSName((String) name);
                break;
            case NAME_DIRECTORY:
                result = new X500Name((String) name);
                break;
            case NAME_URI:
                result = new URIName((String) name);
                break;
            case NAME_IP:
                result = new IPAddressName((String) name);
                break;
            case NAME_OID:
                result = new OIDName((String) name);
                break;
            default:
                throw new IOException('unable to parse String names of type ' + type);
        }
        if (debug != null) {
            debug.println('X509CertSelector.makeGeneralNameInterface() ' + 'result: ' + result.toString());
        }
    } else if (name instanceof byte[]) {
        DerValue val = new DerValue((byte[]) name);
        if (debug != null) {
            debug.println('X509CertSelector.makeGeneralNameInterface() is byte[]');
        }
        switch(type) {
            case NAME_ANY:
                result = new OtherName(val);
                break;
            case NAME_RFC822:
                result = new RFC822Name(val);
                break;
            case NAME_DNS:
                result = new DNSName(val);
                break;
            case NAME_X400:
                result = new X400Address(val);
                break;
            case NAME_DIRECTORY:
                result = new X500Name(val);
                break;
            case NAME_EDI:
                result = new EDIPartyName(val);
                break;
            case NAME_URI:
                result = new URIName(val);
                break;
            case NAME_IP:
                result = new IPAddressName(val);
                break;
            case NAME_OID:
                result = new OIDName(val);
                break;
            default:
                throw new IOException('unable to parse byte array names of ' + 'type ' + type);
        }
        if (debug != null) {
            debug.println('X509CertSelector.makeGeneralNameInterface() result: ' + result.toString());
        }
    } else {
        if (debug != null) {
            debug.println('X509CertSelector.makeGeneralName() input name ' + 'not String or byte array');
        }
        throw new IOException('name not String or byte array');
    }
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.datatransfer.DataFlavor.readExternal(ObjectInput)

/**
    * Restores this <code>DataFlavor</code> from a Serialized state.
    */
public synchronized void readExternal(ObjectInput is) throws IOException, ClassNotFoundException {
    String rcn = null;
    mimeType = (MimeType) is.readObject();
    if (mimeType != null) {
        humanPresentableName = mimeType.getParameter('humanPresentableName');
        mimeType.removeParameter('humanPresentableName');
        rcn = mimeType.getParameter('class');
        if (rcn == null) {
            throw new IOException('no class parameter specified in: ' + mimeType);
        }
    }
    try {
        representationClass = (Class) is.readObject();
    } catch (OptionalDataException ode) {
        if (!ode.eof || ode.length != 0) {
            throw ode;
        }
        if (rcn != null) {
            representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader());
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.AlgorithmParameters.getEncoded()

/**
     * Returns the parameters in their primary encoding format.
     * The primary encoding format for parameters is ASN.1, if an ASN.1
     * specification for this type of parameters exists.
     * @return the parameters encoded using their primary encoding format.
     * @exception IOException on encoding errors, or if this parameter object
     * has not been initialized.
     */
public final byte[] getEncoded() throws IOException {
    if (this.initialized == false) {
        throw new IOException('not initialized');
    }
    return paramSpi.engineGetEncoded();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.AlgorithmParameters.getEncoded(String)

/**
     * Returns the parameters encoded in the specified scheme.
     * If <code>format</code> is null, the
     * primary encoding format for parameters is used. The primary encoding
     * format is ASN.1, if an ASN.1 specification for these parameters
     * exists.
     * @param format the name of the encoding format.
     * @return the parameters encoded using the specified encoding scheme.
     * @exception IOException on encoding errors, or if this parameter object
     * has not been initialized.
     */
public final byte[] getEncoded(String format) throws IOException {
    if (this.initialized == false) {
        throw new IOException('not initialized');
    }
    return paramSpi.engineGetEncoded(format);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.Reader.reset()

/**
     * Reset the stream.  If the stream has been marked, then attempt to
     * reposition it at the mark.  If the stream has not been marked, then
     * attempt to reset it in some way appropriate to the particular stream,
     * for example by repositioning it to its starting point.  Not all
     * character-input streams support the reset() operation, and some support
     * reset() without supporting mark().
     * @exception  IOException  If the stream has not been marked,
     *                          or if the mark has been invalidated,
     *                          or if the stream does not support reset(),
     *                          or if some other I/O error occurs
     */
public void reset() throws IOException {
    throw new IOException('reset() not supported');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.io.ObjectOutputStream.reset()

/**
     * Reset will disregard the state of any objects already written to the
     * stream.  The state is reset to be the same as a new ObjectOutputStream.
     * The current point in the stream is marked as reset so the corresponding
     * ObjectInputStream will be reset at the same point.  Objects previously
     * written to the stream will not be refered to as already being in the
     * stream.  They will be written to the stream again.
     * @throws IOException if reset() is invoked while serializing an object.
     */
public void reset() throws IOException {
    if (depth != 0) {
        throw new IOException('stream active');
    }
    bout.setBlockDataMode(false);
    bout.writeByte(TC_RESET);
    clear();
    bout.setBlockDataMode(true);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.net.URL.readObject(java.io.ObjectInputStream)

/**
     * readObject is called to restore the state of the URL from the
     * stream.  It reads the components of the URL and finds the local
     * stream handler.
     */
private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    if ((handler = getURLStreamHandler(protocol)) == null) {
        throw new IOException('unknown protocol: ' + protocol);
    }
    if (authority == null && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null) host = '';
        authority = (port == -1) ? host : host + ':' + port;
        int at = host.lastIndexOf('@');
        if (at != -1) {
            userInfo = host.substring(0, at);
            host = host.substring(at + 1);
        }
    } else if (authority != null) {
        int ind = authority.indexOf('@');
        if (ind != -1) userInfo = authority.substring(0, ind);
    }
    path = null;
    query = null;
    if (file != null) {
        int q = file.lastIndexOf('?');
        if (q != -1) {
            query = file.substring(q + 1);
            path = file.substring(0, q);
        } else path = file;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.util.zip.DeflaterOutputStream.write(byte[], int, int)

/**
     * Writes an array of bytes to the compressed output stream. This
     * method will block until all the bytes are written.
     * @param b the data to be written
     * @param off the start offset of the data
     * @param len the length of the data
     * @exception IOException if an I/O error has occurred
     */
public void write(byte[] b, int off, int len) throws IOException {
    if (def.finished()) {
        throw new IOException('write beyond end of stream');
    }
    if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
        throw new IndexOutOfBoundsException();
    } else if (len == 0) {
        return;
    }
    if (!def.finished()) {
        int stride = buf.length;
        for (int i = 0; i < len; i += stride) {
            def.setInput(b, off + i, Math.min(stride, len - i));
            while (!def.needsInput()) {
                deflate();
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.beancontext.BeanContextSupport.writeChildren(ObjectOutputStream)

/** 
     * Used to serialize all children of 
     * this <tt>BeanContext</tt>.
     * @param oos the <tt>ObjectOutputStream</tt> 
     * to use during serialization
     * @throws IOException if serialization failed
     */
public final void writeChildren(ObjectOutputStream oos) throws IOException {
    if (serializable <= 0) return;
    boolean prev = serializing;
    serializing = true;
    int count = 0;
    synchronized (children) {
        Iterator i = children.entrySet().iterator();
        while (i.hasNext() && count < serializable) {
            Map.Entry entry = (Map.Entry) i.next();
            if (entry.getKey() instanceof Serializable) {
                try {
                    oos.writeObject(entry.getKey());
                    oos.writeObject(entry.getValue());
                } catch (IOException ioe) {
                    serializing = prev;
                    throw ioe;
                }
                count++;
            }
        }
    }
    serializing = prev;
    if (count != serializable) {
        throw new IOException('wrote different number of children than expected');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.beancontext.BeanContextServicesSupport.bcsPreSerializationHook(ObjectOutputStream)

/**
     * called from BeanContextSupport writeObject before it serializes the
     * children ...
     * This class will serialize any Serializable BeanContextServiceProviders
     * herein.
     * subclasses may envelope this method to insert their own serialization
     * processing that has to occur prior to serialization of the children
     */
protected synchronized void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException {
    oos.writeInt(serializable);
    if (serializable <= 0) return;
    int count = 0;
    Iterator i = services.entrySet().iterator();
    while (i.hasNext() && count < serializable) {
        Map.Entry entry = (Map.Entry) i.next();
        BCSSServiceProvider bcsp = null;
        try {
            bcsp = (BCSSServiceProvider) entry.getValue();
        } catch (ClassCastException cce) {
            continue;
        }
        if (bcsp.getServiceProvider() instanceof Serializable) {
            oos.writeObject(entry.getKey());
            oos.writeObject(bcsp);
            count++;
        }
    }
    if (count != serializable) throw new IOException('wrote different number of service providers than expected');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

No comments:

Post a Comment