Package java.io

Examples of java.io.OutputStream


    // set the max width of each bar
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaxBarWidth(0.10);

    // print the chart image directly the the HTTP stream
    OutputStream out = response.getOutputStream();
    response.setContentType("image/jpeg");

    try
    {
      ChartUtilities.writeChartAsJPEG(out, 1.0f, barChart, 400, 300);
    }catch(IOException e){
      logger.error("[getOpportunityPieData] Exception thrown.", e);
      throw new ServletException(e);
    }finally{
      out.close();
    }

    // return null (don't forward anywhere, we've done the output already)
    return(null);
  }   // end execute() method
View Full Code Here


                                             ), false);
    return out;
    */

    final Channel channel=this;
    OutputStream out=new OutputStream(){
        private int dataLen=0;
        private Buffer buffer=null;
        private Packet packet=null;
        private boolean closed=false;
        private synchronized void init() throws java.io.IOException{
View Full Code Here

                if (!logPropertiesFile.exists()) {
                    logPropertiesFile.createNewFile();

                    // copy from initial properties file from classpath
                    InputStream in = getClass().getResourceAsStream("/log4j.properties");
                    OutputStream out = new FileOutputStream(logPropertiesFile);
                    byte[] buf = new byte[1024];
                    int len;
                    while ((len = in.read(buf)) > 0) {
                        out.write(buf, 0, len);
                    }
                    in.close();
                    out.close();
                }
            } catch (IOException ex) {
                Logger.getLogger(ApplicationSettings.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
View Full Code Here

    new Thread() {
      public void run() {   
        try {
          Model model = ModelFactory.createDefaultModel();
          model.read(result.in,"");
          OutputStream out = new FileOutputStream("test18-m"+modelOrdinal+".rdf");
          model.write(out, "");
          out.close();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    }.start();
View Full Code Here

        if (inputStream != null) {
            rawLength = 0;
            DeflaterOutputStream def = null;
            OutputStreamCounter osc = new OutputStreamCounter(os);
            OutputStreamEncryption ose = null;
            OutputStream fout = osc;
            if (crypto != null && !crypto.isEmbeddedFilesOnly())
                fout = ose = crypto.getEncryptionStream(fout);
            if (compressed)   
                fout = def = new DeflaterOutputStream(fout, new Deflater(compressionLevel), 0x8000);
           
            byte buf[] = new byte[4192];
            while (true) {
                int n = inputStream.read(buf);
                if (n <= 0)
                    break;
                fout.write(buf, 0, n);
                rawLength += n;
            }
            if (def != null)
                def.finish();
            if (ose != null)
View Full Code Here

          httpConn.setRequestProperty("Authorization", "Basic " + Base64.encodeBytes((username + ':' + password).getBytes())); //$NON-NLS-1$ //$NON-NLS-2$
        }
       
        if (msg != null) {
          httpConn.setDoOutput(true);
          OutputStream os = httpConn.getOutputStream();
          InputStream is = msg.getInputStream();
          ObjectConverterUtil.write(os, is, -1);
        }
       
        return new HttpDataSource(url, httpConn);
View Full Code Here

    private void testFileRead() throws Exception {
        Connection conn = getConnection("functions");
        Statement stat = conn.createStatement();
        String fileName = getBaseDir() + "/test.txt";
        Properties prop = System.getProperties();
        OutputStream out = IOUtils.openFileOutputStream(fileName, false);
        prop.store(out, "");
        out.close();
        ResultSet rs = stat.executeQuery("SELECT LENGTH(FILE_READ('" + fileName + "')) LEN");
        rs.next();
        assertEquals(IOUtils.length(fileName), rs.getInt(1));
        rs = stat.executeQuery("SELECT FILE_READ('" + fileName + "') PROP");
        rs.next();
View Full Code Here

                return;
            }

            // get data from client
            boolean failure = false;
            OutputStream os = null;
            long transSz = 0L;
            try {

                // find offset
                long offset = 0L;
                if (file.doesExist()) {
                    offset = file.getSize();
                }

                // open streams
                os = file.createOutputStream(offset);

                // transfer data
                transSz = dataConnection.transferFromClient(session.getFtpletSession(), os);

                // attempt to close the output stream so that errors in
                // closing it will return an error to the client (FTPSERVER-119)
                if(os != null) {
                    os.close();
                }

                LOG.info("File uploaded {}", fileName);

                // notify the statistics component
View Full Code Here

                return;
            }

            // transfer data
            boolean failure = false;
            OutputStream outStream = null;
            long transSz = 0L;
            try {
                outStream = file.createOutputStream(skipLen);
                transSz = dataConnection.transferFromClient(session.getFtpletSession(), outStream);

                // attempt to close the output stream so that errors in
                // closing it will return an error to the client (FTPSERVER-119)
                if(outStream != null) {
                    outStream.close();
                }

                LOG.info("File uploaded {}", fileName);

                // notify the statistics component
View Full Code Here

            if (dataSoc == null) {
                throw new IOException("Cannot open data connection.");
            }

            // create output stream
            OutputStream os = dataSoc.getOutputStream();
            if (factory.isZipMode()) {
                os = new DeflaterOutputStream(os);
            }
            return os;
        } catch (IOException ex) {
View Full Code Here

TOP

Related Classes of java.io.OutputStream

Copyright © 2018 www.massapicom. 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.