Examples of InputStream


Examples of java.io.InputStream

    if (params.SoLinger >= 0)
      socket.setSoLinger(true, params.SoLinger);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OutputStream os = socket.getOutputStream();
    InputStream is = socket.getInputStream();

    // Writes the Joram magic number
    baos.write(MetaData.joramMagic);
    // Writes the current date
    StreamUtil.writeTo(System.currentTimeMillis(), baos);
View Full Code Here

Examples of java.io.InputStream

        {
            _truststore=_keystore;
            _truststoreType=_keystoreType;
        }

        InputStream keystoreInputStream = null;

        KeyManager[] keyManagers=null;
        KeyStore keyStore = null;
        try
        {
            if (_keystore!=null)
            {
                keystoreInputStream=Resource.newResource(_keystore).getInputStream();
                keyStore = KeyStore.getInstance(_keystoreType);
                keyStore.load(keystoreInputStream,_password==null?null:_password.toString().toCharArray());
            }
        }
        finally
        {
            if (keystoreInputStream != null)
                keystoreInputStream.close();
        }

        KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance(_sslKeyManagerFactoryAlgorithm);
        keyManagerFactory.init(keyStore,_keyPassword==null?(_password==null?null:_password.toString().toCharArray()):_keyPassword.toString().toCharArray());
        keyManagers=keyManagerFactory.getKeyManagers();


        TrustManager[] trustManagers=null;
        InputStream truststoreInputStream = null;
        KeyStore trustStore = null;
        try
        {
            if (_truststore!=null)
            {
                truststoreInputStream = Resource.newResource(_truststore).getInputStream();
                trustStore=KeyStore.getInstance(_truststoreType);
                trustStore.load(truststoreInputStream,_trustPassword==null?null:_trustPassword.toString().toCharArray());
            }
        }
        finally
        {
            if (truststoreInputStream != null)
                truststoreInputStream.close();
        }


        TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance(_sslTrustManagerFactoryAlgorithm);
        trustManagerFactory.init(trustStore);
View Full Code Here

Examples of java.io.InputStream

  // -------------------------------------------------------------------------

  protected File fileRef()
    throws Exception
  {
    InputStream archiveStream ;
    FileOutputStream fileStream ;
    ZipEntry entry ;
    File tempFile ;
   
    if ( this.isInArchive() )
View Full Code Here

Examples of java.io.InputStream

            URL url = current.findResource("plugin.properties");

            if ( url != null ){
              URLConnection connection = url.openConnection();

              InputStream is = connection.getInputStream();

              props.load(is);

            }else{
View Full Code Here

Examples of java.io.InputStream

    if (args.length == 0) {
      run(null, System.in, imageInfo, verbose);
    } else {
      int index = 0;
      while (index < args.length) {
        InputStream in = null;
        try {
          String name = args[index++];
          System.out.print(name + ";");
          if (name.startsWith("http://")) {
            in = new URL(name).openConnection().getInputStream();
          } else {
            in = new FileInputStream(name);
          }
          run(name, in, imageInfo, verbose);
          in.close();
        } catch (Exception e) {
          System.out.println(e);
          try {
            in.close();
          } catch (Exception ee) {
          }
        }
      }
    }
View Full Code Here

Examples of java.io.InputStream

public class PackageBuilderTest extends JbpmTestCase {

    public void testRuleFlow() throws Exception {
        PackageBuilder builder = new PackageBuilder();

        InputStream in = this.getClass().getResourceAsStream( "/org/jbpm/integrationtests/ruleflow.rfm" );
        assertNotNull( in );

        builder.addPackage( new PackageDescr( "com.sample" ) );

        builder.addRuleFlow( new InputStreamReader( in ) );
View Full Code Here

Examples of java.io.InputStream

        PackageBuilder builder = new PackageBuilder();
        // Set the system property so that automatic conversion can happen
        System.setProperty( "drools.ruleflow.port",
                            "true" );

        InputStream in = this.getClass().getResourceAsStream( "/org/jbpm/integrationtests/ruleflow40.rfm" );
        assertNotNull( in );

        builder.addPackage( new PackageDescr( "com.sample" ) );

        builder.addRuleFlow( new InputStreamReader( in ) );
View Full Code Here

Examples of java.io.InputStream

      Instances trainHeader = null;

      m_Log.statusMessage("Loading model from file...");

      try {
  InputStream is = new FileInputStream(selected);
  if (selected.getName().endsWith(PMML_FILE_EXTENSION)) {
    PMMLModel model = PMMLFactory.getPMMLModel(is, m_Log);
    if (model instanceof PMMLClassifier) {
      classifier = (PMMLClassifier)model;
      /*trainHeader =
View Full Code Here

Examples of java.io.InputStream

          // System.out.println( "read cache file " + scratch_file_name + " for " + this );

       
        Properties p = new Properties();
       
        InputStream  fis = scratch_file_is;
       
        try{
                 
          p.load( fis );
         
          fis.close();
         
          scratch_file_is = new FileInputStream( scratch_file_name );
         
          messages = new LightHashMap();
         
          messages.putAll( p );
         
          result = messages;
         
        }catch( Throwable e ){
         
          if ( fis != null ){
           
            try{
              fis.close();
             
            }catch( Throwable f ){
            }
          }
         
View Full Code Here

Examples of java.io.InputStream

                while (iterator.hasNext()) {
                    try {
                        Repository repository = (Repository) iterator.next();
                        Resource res = repository.getResource(resourceName);
                        if (res != null && res.exists()) {
                            InputStream in = res.getInputStream();
                            temp.load(in);
                            in.close();
                        }
                    } catch (IOException iox) {
                        iox.printStackTrace();
                    }
                }
            }

            // if these are subproperties, reload them from the parent properties
            if (parentProperties != null && prefix != null) {
                parentProperties.update();
                Iterator it = parentProperties.entrySet().iterator();
                int prefixLength = prefix.length();
                while (it.hasNext()) {
                    Map.Entry entry = (Map.Entry) it.next();
                    String key = entry.getKey().toString();
                    if (key.regionMatches(ignoreCase, 0, prefix, 0, prefixLength)) {
                        temp.put(key.substring(prefixLength), entry.getValue());
                    }
                }

            }

            // at last we try to load properties from the resource list
            if (resources != null) {
                Iterator iterator = resources.iterator();
                while (iterator.hasNext()) {
                    try {
                        Resource res = (Resource) iterator.next();
                        if (res.exists()) {
                            InputStream in = res.getInputStream();
                            temp.load(in);
                            in.close();
                        }
                    } catch (IOException iox) {
                        iox.printStackTrace();
                    }
                }
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.