Package java.io

Examples of java.io.InputStream.mark()


        String message = "";
        if (status == ClientResponse.Status.BAD_REQUEST) {
            clientResponse.bufferEntity();
            InputStream in = clientResponse.getEntityInputStream();
            try {
                in.mark(MB);
                try {
                    message = clientResponse.getEntity(APIResult.class).getMessage();
                } catch (Throwable e) {
                    in.reset();
                    message = clientResponse.getEntity(InstancesResult.class).getMessage();
View Full Code Here


            InputStream in = httpRequest.getInputStream();
            if (in != null) {
                // use a buffered input stream to find out whether there actually
                // is a request body
                InputStream bin = new BufferedInputStream(in);
                bin.mark(1);
                boolean isEmpty = -1 == bin.read();
                bin.reset();
                if (!isEmpty) {
                    DocumentBuilder docBuilder = BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
View Full Code Here

            InputStream in = httpRequest.getInputStream();
            if (in != null) {
                // use a buffered input stream to find out whether there actually
                // is a request body
                InputStream bin = new BufferedInputStream(in);
                bin.mark(1);
                boolean isEmpty = -1 == bin.read();
                bin.reset();
                if (!isEmpty) {
                    DocumentBuilder docBuilder = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
View Full Code Here

        } catch (RuntimeException e) {
            LOGGER.error(e.getMessage());
            throw e;
        }
        try {
            is.mark(256 * 1024);
            JarInputStream jar = new JarInputStream(is);
            Manifest m = jar.getManifest();
            if(m == null) {
                throw new BundleException("Manifest not present in the first entry of the zip " + bundleLocation);
            }
View Full Code Here

      }

      boolean ok = false;
      try {
        final byte[] hdr = new byte[64];
        in.mark(20);
        IO.readFully(in, hdr, 0, 2);

        if (isStandardFormat(hdr)) {
          in.reset();
          in = buffer(inflate(in, size, id));
View Full Code Here

      }

      boolean ok = false;
      try {
        final byte[] hdr = new byte[64];
        in.mark(20);
        IO.readFully(in, hdr, 0, 2);

        if (isStandardFormat(hdr)) {
          in.reset();
          in = buffer(inflate(in, size, id));
View Full Code Here

        } catch (RuntimeException e) {
            LOGGER.error(e.getMessage());
            throw e;
        }
        try {
            is.mark(256 * 1024);
            JarInputStream jar = new JarInputStream(is);
            Manifest m = jar.getManifest();
            if(m == null) {
                throw new BundleException("Manifest not present in the first entry of the zip " + bundleLocation);
            }
View Full Code Here

                if ( entity != null ) {
                    InputStream content = entity.getContent();
                    if ( retryCount > 0 ) {
                        if ( content.markSupported() ) {
                            content.reset();
                            content.mark(-1);
                        }
                    } else {
                        if ( content.markSupported() ) {
                            content.mark(-1);
                        }
View Full Code Here

                            content.reset();
                            content.mark(-1);
                        }
                    } else {
                        if ( content.markSupported() ) {
                            content.mark(-1);
                        }
                    }
                }

                exception = null;
View Full Code Here

    private DocumentReport getTagSoupDOM(ExtractionParameters extractionParameters)
    throws IOException, ValidatorException {
        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(),
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.