Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


                // Write the IFD.
                writeDirectory(ifdOffset, fields, nextIFDOffset);

                // Write the image data.
                memoryStream.writeTo(output);

                // Write an extra byte for IFD word alignment if needed.
                if(skipByte) {
                    output.write((byte)0);
                }
View Full Code Here


      try
      {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        XSLTProcessor.log(LogService.LOG_DEBUG,"transforming " + path,null);
        transformer.transform(new DOMSource(document), new StreamResult(output));
        output.writeTo(out);
      }
      catch (TransformerException e)
      {
        XSLTProcessor.log(LogService.LOG_ERROR,"Transformation exception ", e);
      }
View Full Code Here

        {
          transformer.setParameter("request.locale", locale.toString());
        }
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        transformer.transform(new DOMSource(doc), new StreamResult(output));
        output.writeTo(out);
      }
      catch (TransformerException ex)
      {
        XSLTProcessor.log(LogService.LOG_ERROR,"Exception during error output", ex);
      }
View Full Code Here

      outBuffer.flush();
      out.setCode(HttpConstants.STATUS_OKAY);
      out.setHeader("Content-type", mime);
      out.sendHeaders();
      XSLTProcessor.log(LogService.LOG_DEBUG,"File output " + mime,null);
      outArray.writeTo(out);
      fileIn.close();
    }
    catch (Exception e)
    {
      XSLTProcessor.log(LogService.LOG_WARNING,"Exception loading file " + file, e);
View Full Code Here

    out.print("</body></html>\n");
    out.close();

    // Flush our buffer to the real servlet output
    OutputStream servletOut = response.getOutputStream();
    baos.writeTo(servletOut);
    servletOut.close();
  }

  /**
   * Print a view of pools to the given output writer.
View Full Code Here

        else if (!skip && output != null) {
          if (logMINOR)
            Logger
                    .minor(this, "Writing " + chunkTypeString + " (" + baos.size()
                            + ") to the output bucket");
          baos.writeTo(output);
          baos.flush();
        }
        lastChunkType = chunkTypeString;
      }
View Full Code Here

        dis.readFully(buf);
        dos.write(buf);
        Logger.minor(this, "Copied start-of-frame marker length "+(blockLength-2));

        if(baos != null)
          baos.writeTo(output); // will continue; at end

        // Now copy the scan itself

        int prevChar = -1;
        while(true) {
View Full Code Here

      if(cis.count() != countAtStart + blockLength)
        throwError("Invalid frame", "The length of the frame is incorrect (read "+
            (cis.count()-countAtStart)+" bytes, frame length "+blockLength+" for type "+Integer.toHexString(markerType)+").");
      // Write frame
      baos.writeTo(output);
    }

    // In future, maybe we will check the other chunks too.
    // In particular, we may want to delete, or filter, the comment blocks.
    // FIXME
View Full Code Here

      response.endElement("", "exception", "exception");
      response.endDocument();

      http.sendResponseHeaders(status, responseBody.size());
      responseBody.writeTo(http.getResponseBody());
      http.getResponseBody().close();
      http.close();
    } catch (Exception e1) {
      logger.error(e1);
      throw new IOException(e1.getMessage());
View Full Code Here

            // Otherwise we get an exception when Cocoon.process
            // tries to flush/close the stream again.
            ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
            TranscoderOutput transOutput = new TranscoderOutput(baos);
            transcoder.transcode(transInput, transOutput);
            baos.writeTo(this.output);
        } catch (Exception ex) {
            log.error("SVGSerializer: Exception writing image", ex);
            throw new SAXException("Exception writing image ", ex);
        }
    }
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.