Package java.io

Examples of java.io.BufferedInputStream.mark()


            final boolean replaceInclude, String[] confsToExclude)
            throws IOException, SAXException {
        final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8"));
        final BufferedInputStream in = new BufferedInputStream(inStream);

        in.mark(MAX_HEADER_LENGTH); // assume the header is never larger than 10000 bytes.
        copyHeader(in, out);
        in.reset(); // reposition the stream at the beginning

        try {
            UpdaterHandler updaterHandler = new UpdaterHandler(settings, out, resolvedRevisions,
View Full Code Here


            }
            // workaround for pre-1.3 VMs that don't recognize UTF-16
            if (version.startsWith("1.2"|| version.startsWith("1.1")) {
                if (encoding.equalsIgnoreCase("UTF-16")) {
                    // is it  big-endian or little-endian?
                    in.mark(2);
                    int first = in.read();
                    if (first == 0xFF) encoding = "UnicodeLittle";
                    else encoding="UnicodeBig";
                    in.reset()
                }
View Full Code Here

                entry = zip.getNextZipEntry();
                continue;
            }

            InputStream entryStream = new BufferedInputStream(zip, 4096);
            entryStream.mark(4096);
            IWORKDocumentType type = IWORKDocumentType.detectType(entryStream);
            entryStream.reset();
           
            if(type != null) {
               XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
View Full Code Here

    protected Bundle installBundleIfNeeded(String bundleLocation) throws IOException, BundleException {
        LOGGER.debug("Checking " + bundleLocation);
        InputStream is = new BufferedInputStream(new URL(bundleLocation).openStream());
        try {
            is.mark(256 * 1024);
            JarInputStream jar = new JarInputStream(is);
            Manifest m = jar.getManifest();
            String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
            String vStr = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
            Version v = vStr == null ? Version.emptyVersion : Version.parseVersion(vStr);
View Full Code Here

     * @throws IOException Problems during opening of the Stream
     * @since 3.0
     */
    public static InputStream openSaveGZipInputStream(final InputStream is) throws IOException {
        final BufferedInputStream bis = new BufferedInputStream(is);
        bis.mark(64);
        try {
            final InputStream result = new GZIPInputStream(bis);
            return result;
        } catch (final IOException e) {
            e.printStackTrace();
View Full Code Here

            byte[] reply = new byte[size];

            // figure out the stream size as we need to pass it in the header
            BufferedInputStream buffer = new BufferedInputStream(data, size);
            try {
                buffer.mark(Integer.MAX_VALUE);
                while ((read = buffer.read(reply)) != -1) {
                    count += read;
                }

                // send the header
View Full Code Here

            final boolean replaceInclude, String[] confsToExclude)
            throws IOException, SAXException {
        final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8"));
        final BufferedInputStream in = new BufferedInputStream(inStream);

        in.mark(MAX_HEADER_LENGTH); // assume the header is never larger than 10000 bytes.
        copyHeader(in, out);
        in.reset(); // reposition the stream at the beginning

        try {
            UpdaterHandler updaterHandler = new UpdaterHandler(settings, out, resolvedRevisions,
View Full Code Here

        //If document is XML, find the encoding and give it priority over
        //the one returned by the connection

        //we mark for resetting later. We need a big number to ensure
        // stack of streams don't read it to fill buffers.
        is.mark( 20480 );
        BufferedReader asciiReader = new BufferedReader( new InputStreamReader( is, "ASCII" ) );
        String decl = asciiReader.readLine();
        //System.err.println( "Line: " + decl );
        String key = "encoding=\"";
        //decl nul means that the connection got reset...
View Full Code Here

        //If document is XML, find the encoding and give it priority over
        //the one returned by the connection

        //we mark for resetting later. We need a big number to ensure
        // stack of streams don't read it to fill buffers.
        is.mark( 20480 );
        BufferedReader asciiReader = new BufferedReader( new InputStreamReader( is, "ASCII" ) );
        String decl = asciiReader.readLine();
        //System.err.println( "Line: " + decl );
        String key = "encoding=\"";
        //decl nul means that the connection got reset...
View Full Code Here

            throw new NullPointerException("No password supplied for PKCS#12 KeyStore.");
        }

        BufferedInputStream             bufIn = new BufferedInputStream(stream);

        bufIn.mark(10);

        int head = bufIn.read();

        if (head != 0x30)
        {
View Full Code Here

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