Package java.io

Examples of java.io.BufferedInputStream.reset()


        // No extensions present; the file ended where we expected.
        //
        break;
      }

      in.reset();
      md.update(hdr, 0, 8);
      IO.skipFully(in, 8);

      long sz = NB.decodeUInt32(hdr, 4);
      switch (NB.decodeInt32(hdr, 0)) {
View Full Code Here


        intBytes[0] = bis.read();
        intBytes[1] = bis.read();
        intBytes[2] = bis.read();
        intBytes[3] = bis.read();
        if ((intBytes[0] | intBytes[1] | intBytes[2] | intBytes[3] ) < 0) {
            bis.reset();
        }
        unmaThingy.strCount = stream.readUTF();

        assertTrue( thingy.equals(unmaThingy) );
    }
View Full Code Here

    BufferedInputStream in = new BufferedInputStream(is, is.available());
    in.mark(is.available());
   
    // cycle through our source until one of them works
    for (int i=0;i<sources.size();i++) {
      in.reset();
      try {
        LoadableImageData data = (LoadableImageData) sources.get(i);
       
        buffer = data.loadImage(in, flipped, forceAlpha, transparent);
        picked = data;
View Full Code Here

        if (documentReport == null || !extractionParameters.equals(tagSoupDOMRelatedParameters)) {
            ensureHasLocalCopy();
            final InputStream is = new BufferedInputStream( localDocumentSource.openInputStream() );
            is.mark(Integer.MAX_VALUE);
            final String candidateEncoding = getParserEncoding();
            is.reset();
            final TagSoupParser tagSoupParser = new TagSoupParser(
                    is,
                    documentURI.stringValue(),
                    candidateEncoding
            );
View Full Code Here

        //call this method to create the reader
        Reader reader = XmlCharsetDetector.createReader(input, encoding);

        //rest the input
        input.reset();

        //ensure the reader is a buffered reader
        if (reader instanceof BufferedReader) {
            return (BufferedReader) reader;
        }
View Full Code Here

                    is.mark(1);
                    try {
                        ObjectInput oi = null;
                        while( true ) {
                            for ( int i=100; oi==null && i>0; i--) {
                                is.reset();
                                try {
                                    is.mark(i);
                                    oi = new ObjectInputStream(is);
                                } catch( StreamCorruptedException e) {
                                    is.reset();
View Full Code Here

                                is.reset();
                                try {
                                    is.mark(i);
                                    oi = new ObjectInputStream(is);
                                } catch( StreamCorruptedException e) {
                                    is.reset();
                                    is.read();
                                }
                            }
                            if ( oi==null ) {
                                break;
View Full Code Here

        BufferedInputStream bis = new BufferedInputStream( is, 64 * 1024 );
        bis.mark( 64 * 1024 );
        JarInputStream jis = new JarInputStream( bis );
        mf.getMainAttributes().putAll( jis.getManifest().getMainAttributes() );
        mf.getEntries().putAll( jis.getManifest().getEntries() );
        bis.reset();
        return bis;
    }

    /**
     * Parse a given OSGi header into a list of paths
View Full Code Here

        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,
                    status, revision, pubdate, ns, replaceInclude, confsToExclude, inStreamCtx);
            XMLHelper.parse(in, null, updaterHandler, updaterHandler);
View Full Code Here

                    // is it  big-endian or little-endian?
                    in.mark(2);
                    int first = in.read();
                    if (first == 0xFF) encoding = "UnicodeLittle";
                    else encoding="UnicodeBig";
                    in.reset()
                }
                else if (encoding.equalsIgnoreCase("UnicodeBigUnmarked")) {
                    encoding = "UnicodeBig";
                }
                else if (encoding.equalsIgnoreCase("UnicodeLittleUnmarked")) {
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.