Package java.io

Examples of java.io.InputStream.reset()


        DocumentCollection collection = (DocumentCollection)getServletContext().getAttribute( "collection" );
        if ( collection == null ) LOGGER.fatal( "The servlet context does not contain a document collection." );
        response.setContentType( request.getParameter( "m" ) );
        response.setCharacterEncoding( "UTF-8" );
        InputStream rawContent = collection.stream( Integer.parseInt( request.getParameter( "doc" ) ) );
        for( int i = skip; i-- != 0; ) rawContent.reset();
        IOUtils.copy( rawContent, response.getOutputStream() );
      }
    } catch( RuntimeException e ) {
      e.printStackTrace();
      LOGGER.error( e.toString() );
View Full Code Here


        assertNull(msg.getSOAPHeader());
        assertNull(restoredMsg.getSOAPHeader());
       
        InputStream is2 = pu.getContextAsInputStream(restored);
        is.reset();
        is2.reset();       
        assertEquals(is.available(), is2.available());
    }
       
}
View Full Code Here

      }
       InputStream is = getResetableInputStream();
       if (is!=null) {
        //reseatable can read again bytes.
         if (bytes==null) {
            is.reset();      
            bytes=JavaUtils.getBytesFromStream(is);
         }      
         return bytes;              
      }                   
         Canonicalizer20010315OmitComments c14nizer =
View Full Code Here

            if (bytes!=null) {
                //already read write it, can be rea.
              diOs.write(bytes,0,bytes.length);
                return;
            }           
            is.reset();           
            int num;
            byte[] bytesT = new byte[1024];
            while ((num=is.read(bytesT))>0) {
              diOs.write(bytesT,0,num);
            }
View Full Code Here

                                final ScraperInputStream htmlFilter = new ScraperInputStream(fis,"UTF-8",new DigestURI("http://localhost"),null,false);
                                final String charset = htmlParser.patchCharsetEncoding(htmlFilter.detectCharset());
                                if(charset != null)
                                    mimeType = mimeType + "; charset="+charset;
                                // reset position
                                fis.reset();
                            }
                        }
                    }

                    // write the array to the client
View Full Code Here

                if (response.getKeepAlive()) {
                    InputStream is = request.getRawInputStream();
                    if (is != null && is.markSupported()) {
                        is.mark(4);
                        if (is.read() != '\r' || is.read() != '\n')
                            is.reset();
                    }
                } else
                    break;

                request.destroy();
View Full Code Here

        Workspace workspace = pc.getCurrentWorkspace();

        String sample = "/org/gephi/desktop/welcome/samples/Les Miserables.gexf";
        final InputStream stream = WelcomeTopComponent.class.getResourceAsStream(sample);
        try {
            stream.reset();
        } catch (IOException ex) {
            //Exceptions.printStackTrace(ex);
        }
        ImportController importController = Lookup.getDefault().lookup(ImportController.class);
        FileImporter fileImporter = importController.getFileImporter(".gexf");
View Full Code Here

                final String importer = fileName.substring(fileName.lastIndexOf('.'), fileName.length());
                JXHyperlink fileLink = new JXHyperlink(new AbstractAction() {

                    public void actionPerformed(ActionEvent e) {
                        try {
                            stream.reset();
                        } catch (IOException ex) {
                            //Exceptions.printStackTrace(ex);
                        }
                        ImportControllerUI importController = Lookup.getDefault().lookup(ImportControllerUI.class);
                        importController.importStream(stream, importer);
View Full Code Here

                if (count == 4) {
                    Object [] encodingDesc = getEncodingName(b4, count);
                    encoding = (String)(encodingDesc[0]);
                    isBigEndian = (Boolean)(encodingDesc[1]);

                    stream.reset();
                    // Special case UTF-8 files with BOM created by Microsoft
                    // tools. It's more efficient to consume the BOM than make
                    // the reader perform extra checks. -Ac
                    if (count > 2 && encoding.equals("UTF-8")) {
                        int b0 = b4[0] & 0xFF;
View Full Code Here

                            break;
                    }
                    if (count == 3) {
                        if (b3[0] != 0xEF || b3[1] != 0xBB || b3[2] != 0xBF) {
                            // First three bytes are not BOM, so reset.
                            stream.reset();
                        }
                    }
                    else {
                        stream.reset();
                    }
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.