Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.ByteArrayOutputStream.toByteArray()


            sourceInputStream = source.getInputStream();
            destOutputStream = destination.getOutputStream();
            if(useBuffer) {
                final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
                CopyUtils.copy(sourceInputStream, sourceBos);
                CopyUtils.copy(sourceBos.toByteArray(), destOutputStream);
            }
            else
                CopyUtils.copy(sourceInputStream, destOutputStream);
        } finally {
            if(destOutputStream != null) {
View Full Code Here


 
  private static byte[] toBytes(AuthenticationToken token) throws AccumuloSecurityException {
    try {
      ByteArrayOutputStream bais = new ByteArrayOutputStream();
      token.write(new DataOutputStream(bais));
      byte[] serializedToken = bais.toByteArray();
      bais.close();
      return serializedToken;
    } catch (IOException e) {
      log.error(e, e);
      throw new AccumuloSecurityException("unknown", SecurityErrorCode.SERIALIZATION_ERROR);
View Full Code Here

                                    ByteArrayOutputStream certDataStream = new ByteArrayOutputStream( );
                                    certDataStream.write(sslCert.getCert().getBytes());

                                    if (! SSL.isSslCertKeyPresent(_netscalerService, certKeyName)) {

                                        SSL.uploadCert(_ip, _username, _password, certFilename, certDataStream.toByteArray());
                                        SSL.uploadKey(_ip, _username, _password, keyFilename, sslCert.getKey().getBytes());
                                        SSL.createSslCertKey(_netscalerService, certFilename, keyFilename, certKeyName, sslCert.getPassword());
                                    }

                                    if (previousCertKeyName != null && ! SSL.certLinkExists(_netscalerService, certKeyName, previousCertKeyName)){
View Full Code Here

        String path = resourcePath;
        for (SchemaInfo schemaInfo: schemas.values()) {
            XmlSchema schema = schemaInfo.getSchema();
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            schema.write(byteArrayOutputStream);
            byte[] xsdContent = byteArrayOutputStream.toByteArray();

            String schemaPath = schemaInfo.getProposedRegistryURL();
            Resource xsdResource;
            if (metaResource != null && registry.resourceExists(schemaPath)) {
                xsdResource = registry.get(schemaPath);
View Full Code Here

            for (WSDLInfo wsdlInfo : wsdls.values()) {
                Definition wsdlDefinition = wsdlInfo.getWSDLDefinition();
                WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                wsdlWriter.writeWSDL(wsdlDefinition, byteArrayOutputStream);
                byte[] wsdlResourceContent = byteArrayOutputStream.toByteArray();

                // create a resource this wsdlResourceContent and put it to the registry with the name
                // importedResourceName (in some path)
                String wsdlPath = wsdlInfo.getProposedRegistryURL();
                Resource wsdlResource;
View Full Code Here

            gzos.write(bytes, 0, bytes.length);
            gzos.finish();
            gzos.close();

            byte[] compressedByteArray = baos.toByteArray();
            baos.close();

            if (logger.isDebugEnabled())
            {
                logger.debug("Compressed message to size: " + compressedByteArray.length);
View Full Code Here

            IOUtils.copy(gzis, baos);
            gzis.close();
            bais.close();

            byte[] uncompressedByteArray = baos.toByteArray();
            baos.close();

            if (logger.isDebugEnabled())
            {
                logger.debug("Uncompressed message to size: " + uncompressedByteArray.length);
View Full Code Here

        } // end finally

        // Return value according to relevant encoding.
        try
        {
            return new String(baos.toByteArray(), PREFERRED_ENCODING);
        } // end try
        catch (UnsupportedEncodingException uue)
        {
            return new String(baos.toByteArray());
        } // end catch
View Full Code Here

        {
            return new String(baos.toByteArray(), PREFERRED_ENCODING);
        } // end try
        catch (UnsupportedEncodingException uue)
        {
            return new String(baos.toByteArray());
        } // end catch

    } // end encode

    /**
 
View Full Code Here

            } // end finally

            // Return value according to relevant encoding.
            try
            {
                return new String(baos.toByteArray(), PREFERRED_ENCODING);
            } // end try
            catch (UnsupportedEncodingException uue)
            {
                return new String(baos.toByteArray());
            } // end catch
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.