Examples of ByteArrayOutputStream

@author Michael Zhou
  • com.alibaba.simpleimage.io.ByteArrayOutputStream
    本代码专为图片缓存使用,故默认缓冲区设得比较大 非同步的ByteArrayOutputStream替换方案, 执行toByteArray()方法时返回的是只读的内部字节数组, 避免了没有必要的字节复制. 本代码移植自IBM developer works精彩文章, 参见package文档. @author Michael Zhou @author wendell @version $Id: ByteArrayOutputStream.java 593 2004-02-26 13:47:19Z baobao $
  • com.ibm.jvm.util.ByteArrayOutputStream
  • com.zaranux.client.crypto.ByteArrayOutputStream
    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().

    Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException. @author Arthur van Hoff @since JDK1.0

  • java.io.ByteArrayOutputStream
    ByteArrayOutputStream is a class whose underlying stream is represented by a byte array. As bytes are written to this stream, the local byte array may be expanded to hold more bytes. @see ByteArrayInputStream
  • net.gleamynode.netty.array.ByteArrayOutputStream
    @author The Netty Project (netty@googlegroups.com) @author Trustin Lee (trustin@gmail.com) @version $Rev: 476 $, $Date: 2008-07-04 15:06:37 +0900 (Fri, 04 Jul 2008) $ @see ByteArrayInputStream @see ByteArrayBufferInputStream @apiviz.uses net.gleamynode.netty.array.CompositeByteArray
  • org.apache.activeio.util.ByteArrayOutputStream
  • org.apache.activemq.util.ByteArrayOutputStream
    Very similar to the java.io.ByteArrayOutputStream but this version is not thread safe and the resulting data is returned in a ByteSequence to avoid an extra byte[] allocation.
  • org.apache.axis.utils.ByteArrayOutputStream
    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.

    The data can be retrieved using toByteArray() and toString().

    Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

    This is an alternative implementation of the java.io.ByteArrayOutputStream class. The original implementation only allocates 32 bytes at the beginning. As this class is designed for heavy duty it starts at 1024 bytes. In contrast to the original it doesn't reallocate the whole memory block but allocates additional buffers. This way no buffers need to be garbage collected and the contents don't have to be copied to the new buffer. This class is designed to behave exactly like the original. The only exception is the deprecated toString(int) method that has been ignored. @author Jeremias Maerki

  • org.apache.commons.io.output.ByteArrayOutputStream
    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.

    The data can be retrieved using toByteArray() and toString().

    Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

    This is an alternative implementation of the java.io.ByteArrayOutputStream class. The original implementation only allocates 32 bytes at the beginning. As this class is designed for heavy duty it starts at 1024 bytes. In contrast to the original it doesn't reallocate the whole memory block but allocates additional buffers. This way no buffers need to be garbage collected and the contents don't have to be copied to the new buffer. This class is designed to behave exactly like the original. The only exception is the deprecated toString(int) method that has been ignored. @author Jeremias Maerki @version $Id: ByteArrayOutputStream.java 369075 2006-01-14 18:23:42Z scolebourne $

  • org.apache.wicket.util.io.ByteArrayOutputStream
    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.

    The data can be retrieved using toByteArray() and toString().

    Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

    This is an alternative implementation of the java.io.ByteArrayOutputStream class. The original implementation only allocates 32 bytes at the beginning. As this class is designed for heavy duty it starts at 1024 bytes. In contrast to the original it doesn't reallocate the whole memory block but allocates additional buffers. This way no buffers need to be garbage collected and the contents don't have to be copied to the new buffer. This class is designed to behave exactly like the original. The only exception is the deprecated toString(int) method that has been ignored. @author Jeremias Maerki @version $Id$

  • org.fusesource.hawtbuf.ByteArrayOutputStream
    irino.com">Hiram Chirino
  • org.more.util.io.output.ByteArrayOutputStream
    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.

    The data can be retrieved using toByteArray() and toString().

    Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

    This is an alternative implementation of the {@link java.io.ByteArrayOutputStream}class. The original implementation only allocates 32 bytes at the beginning. As this class is designed for heavy duty it starts at 1024 bytes. In contrast to the original it doesn't reallocate the whole memory block but allocates additional buffers. This way no buffers need to be garbage collected and the contents don't have to be copied to the new buffer. This class is designed to behave exactly like the original. The only exception is the deprecated toString(int) method that has been ignored. @version $Id: ByteArrayOutputStream.java 1304052 2012-03-22 20:55:29Z ggregory $

  • webit.script.util.ByteArrayOutputStream

  • Examples of java.io.ByteArrayOutputStream

                throw new WsException("Unable to configure parser for WSDL adapter: " + e.getMessage());
            } catch (SAXException e) {
                throw new WsException("Error parsing supplied WSDL: " + e.getMessage());
            }

            ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
            try {
                TransformerFactory tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();

                DOMSource source = new DOMSource(doc);
                StreamResult result = new StreamResult(baos);
                transformer.transform(source, result);
            } catch (TransformerException e) {
                throw new WsException("Error transforming WSDL: " + e.getMessage());
            }
            return baos.toByteArray();
        }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

        public InputStreamWsdlProvider(InputStream inputStream) throws IOException {
            wsdlBytes = inputStreamToBytes(inputStream);
        }

        private byte[] inputStreamToBytes(InputStream in) throws IOException {
            ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
            byte[] buffer = new byte[1024];
            int len;

            try {
                while ((len = in.read(buffer)) >= 0) {
                    out.write(buffer, 0, len);
                }
       
                return out.toByteArray();
            } finally {
                try {
                    in.close();
                    out.close();
                } catch (IOException ignore) {
                }
            }
        }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

        byte[] returnByteArray = null;
        try {
          byte[] zeros = new byte[8];
          Arrays.fill(zeros, (byte)0);
          IvParameterSpec ivSpec = new IvParameterSpec(zeros);
          ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
          serverProperties.store(byteArrayOutStream, "CentraView Server Properties");

          Cipher cipher = Cipher.getInstance("Blowfish/CBC/PKCS5Padding");
          cipher.init(Cipher.ENCRYPT_MODE, blowfishKey, ivSpec);

          returnByteArray = cipher.doFinal(byteArrayOutStream.toByteArray());
        } catch (Exception exception) {
          logger.error("[encryptServerData] Exception thrown.", exception);
        }
        return returnByteArray;
      } //end of encryptServerData method
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

            for (int i = 0; i < data.length; i++) {
                data[i] = new Data(i);
                list1.add(data[i]);
            }

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(list1);

            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            ObjectInputStream ois = new ObjectInputStream(bais);

            TLinkedList list2 = (TLinkedList) ois.readObject();
            assertEquals(list1, list2);
        }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

                            cs.setDomain(remoteDomainUID);                       
                            _remoteWGAConfiguration.add(cs);
                            monitor.worked(1);

                            monitor.setTaskName("updating remote server configuration");
                            ByteArrayOutputStream out = new ByteArrayOutputStream();
                            WGAConfiguration.write(_remoteWGAConfiguration, out);
                            DataSource configDataSource = new ByteArrayDataSource(out.toByteArray(), "WGAConfiguration", "text/xml");
                            _remoteServer.getServices().updateWGAConfiguration(_remoteServer.getSession(), configDataSource);
                            monitor.worked(1);

                            monitor.setTaskName("waiting for remote content store to get available");
                            List<String> dbkeys = new ArrayList<String>();
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

                    throw new RuntimeException("Stream could not be compressed: filter is not a name or array.");
                }
            }
            try {
                // compress
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                DeflaterOutputStream zip = new DeflaterOutputStream(stream, new Deflater(compressionLevel));
                if (streamBytes != null)
                    streamBytes.writeTo(zip);
                else
                    zip.write(bytes);
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

            ts.close();
        }

        private void testTraceDebug() {
            TraceSystem ts = new TraceSystem(null);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ts.setSysOut(new PrintStream(out));
            ts.setLevelSystemOut(TraceSystem.DEBUG);
            ts.getTrace("test").debug(new Exception("error"), "test");
            ts.close();
            String outString = new String(out.toByteArray());
            assertContains(outString, "error");
            assertContains(outString, "Exception");
            assertContains(outString, "test");
        }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

                        if (image.getRawData() != null){
                            bytes = image.getRawData();
                            put(PdfName.LENGTH, new PdfNumber(bytes.length));
                            return;
                        }
                        streamBytes = new ByteArrayOutputStream();
                        transferBytes(is, streamBytes, -1);
                        break;
                    case Image.JPEG2000:
                        put(PdfName.FILTER, PdfName.JPXDECODE);
                        if (image.getColorspace() > 0) {
                            switch(image.getColorspace()) {
                                case 1:
                                    put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
                                    break;
                                case 3:
                                    put(PdfName.COLORSPACE, PdfName.DEVICERGB);
                                    break;
                                default:
                                    put(PdfName.COLORSPACE, PdfName.DEVICECMYK);
                            }
                            put(PdfName.BITSPERCOMPONENT, new PdfNumber(image.getBpc()));
                        }
                        if (image.getRawData() != null){
                            bytes = image.getRawData();
                            put(PdfName.LENGTH, new PdfNumber(bytes.length));
                            return;
                        }
                        streamBytes = new ByteArrayOutputStream();
                        transferBytes(is, streamBytes, -1);
                        break;
                    default:
                        throw new BadPdfFormatException(errorID + " is an unknown Image format.");
                }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

      /* (non-Javadoc)
       * @see org.objectweb.joram.shared.stream.Streamable#writeTo(java.io.OutputStream)
       */
      public void writeTo(OutputStream os) throws IOException {
        StreamUtil.writeTo(principal, os);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        try {
          oos.writeObject(subject);
          oos.flush();
          StreamUtil.writeTo(baos.toByteArray(), os);
          oos.close();
          baos.close();
        } finally {
          try {
            oos.close();
          } catch (IOException exc) {}
          try {
            baos.close();
          } catch (IOException exc) {}
        }
      }
    View Full Code Here

    Examples of java.io.ByteArrayOutputStream

       * @throws IOException
       */
      public String exception(Throwable t) throws IOException{
        if(t == null)
          return null;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try{
          t.printStackTrace(new PrintStream(baos));
        }finally{
          baos.close();
        }
        return baos.toString();
      }
    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.