コード例 #1
0
        /*
         * Constructs a new {@code Manifest} instance obtaining attribute
         * information from the specified input stream.
         *
         * @param is
         *            The {@code InputStream} to read from.
         * @throws IOException
         *             If an error occurs reading the {@code Manifest}.
         */
        public void read(java.io.InputStream isJ)  //throws IOException {
        {
            byte[] buf;
            // Try to read get a reference to the bytes directly
            try {
                buf = org.apache.harmony.luni.util.InputStreamHelper.expose(isJ);
            } catch (java.lang.UnsupportedOperationException uoe) {
                buf = readFully(isJ);
            }

            if (buf.Length == 0)
            {
                return;
            }

            // a workaround for HARMONY-5662
            // replace EOF and NUL with another new line
            // which does not trigger an error
            byte b = buf[buf.Length - 1];

            if (0 == b || 26 == b)
            {
                buf[buf.Length - 1] = (byte)'\n';
            }

            // Attributes.Name.MANIFEST_VERSION is not used for
            // the second parameter for RI compatibility
            im      = new InitManifest(buf, mainAttributes, null);
            mainEnd = im.getPos();
            // FIXME
            im.initEntries(entries, chunks);
            im = null;
        }
コード例 #2
0
        /**
         * Constructs a new {@code Manifest} instance obtaining attribute
         * information from the specified input stream.
         *
         * @param is
         *            The {@code InputStream} to read from.
         * @throws IOException
         *             If an error occurs reading the {@code Manifest}.
         */
        public void read(java.io.InputStream isJ)
        {
            //throws IOException {
            byte[] buf;
            // Try to read get a reference to the bytes directly
            try {
                buf = org.apache.harmony.luni.util.InputStreamHelper.expose(isJ);
            } catch (java.lang.UnsupportedOperationException uoe) {
                buf = readFully(isJ);
            }

            if (buf.Length == 0) {
                return;
            }

            // a workaround for HARMONY-5662
            // replace EOF and NUL with another new line
            // which does not trigger an error
            byte b = buf[buf.Length - 1];
            if (0 == b || 26 == b) {
                buf[buf.Length - 1] = (byte)'\n';
            }

            // Attributes.Name.MANIFEST_VERSION is not used for
            // the second parameter for RI compatibility
            im = new InitManifest(buf, mainAttributes, null);
            mainEnd = im.getPos();
            // FIXME
            im.initEntries(entries, chunks);
            im = null;
        }