Package java.io

Examples of java.io.InputStream


        public IXMLReader getReader() throws IOException, WsException {
            if (m_reader == null) {
                MediaType mediaType = getContentMediaType();
                m_buffer = (InByteBuffer)m_inBufferCache.getInstance();
               
                InputStream inputStream;
                if (hasError()) {
                    inputStream = m_connection.getErrorStream();
                } else {
                    inputStream = m_connection.getInputStream();
                }
View Full Code Here


           
            StringBuffer error = new StringBuffer(ERROR_BUFFER_SIZE);
            String newLine = System.getProperty("line.separator");
            error.append(m_connection.getResponseCode()).append(" ").append(m_connection.getResponseMessage())
                    .append(newLine);
            InputStream errorStream = m_connection.getErrorStream();
            if (m_interceptor != null) {
                errorStream = m_interceptor.intercept(errorStream);
            }
            BufferedReader in = new BufferedReader(new InputStreamReader(errorStream));
            String line;
View Full Code Here

     * Load protocols from a properties file.
     *
     * @param path path to the properties file relative to the classpath
     */
    static void loadProperties(String path) {
        InputStream stream = null;
        try {
            Properties props = new Properties();
            stream = ProtocolDirectory.class.getResourceAsStream(path);
            if (stream == null) {
                throw new RuntimeException("Unable to load required properties file '" + path + '\'');
            }
            props.load(stream);

            for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
                String name = (String) iter.next();
                String objectName = props.getProperty(name);
                Protocol inst = loadProtocol(objectName);
                s_protocolMap.put(name, inst);
            }
        } catch (IOException e) {
            throw new RuntimeException("Unable to load required properties file '" + path + '\'');
        } finally {
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException ignore) {
                }
            }
        }
    }
View Full Code Here

                }
            }
       
            try {
                if (sdef.getWsdlFilepath() != null) {
                    InputStream wsdlStream = Service.class.getResourceAsStream(sdef.getWsdlFilepath());
                    if (wsdlStream == null) {
                        throw new WsConfigurationException("Unable to open WSDL file '" + sdef.getWsdlFilepath() + "'");
                    }
                    WsdlProvider wsdlProvider = new InputStreamWsdlProvider(wsdlStream);
                    if (sdef.getWsdlLocationTransform()) {
View Full Code Here

        for (int i = 0; i < args.length; i++) {
            String arg = args[i];
            int split = arg.indexOf('=');
            String path = arg.substring(0, split);
            if (split > 0) {
                InputStream is = null;
                try {
                    ports[i] = Integer.parseInt(arg.substring(split + 1));
                    is = new FileInputStream(path);
                    sdefs[i] = (ServiceDefinition)ctx.unmarshalDocument(is, null);
                } catch (NumberFormatException e) {
                    System.err.println("Error parsing port number in argument " + i + ": " + arg);
                    valid = false;
                } catch (FileNotFoundException e) {
                    System.err.println("Service definition file not found for argument " + i + ": " + path);
                    valid = false;
                } catch (JiBXException e) {
                    System.err.println("Error unmarshalling service definition " + i + " (" + path + "): "
                        + e.getMessage());
                    valid = false;
                } finally {
                    if (is != null) {
                        try {
                            is.close();
                        } catch (IOException ignore) {
                        }
                    }
                }
            } else {
View Full Code Here

                                   res );
        }

        private static Transformer getTransformer(String stylesheet) throws Exception {
            Transformer transformer = null;
            InputStream xslStream = null;

            try {
                InputStream in = XSLTransformation.class.getResourceAsStream( stylesheet );
                xslStream = new BufferedInputStream( in );
                StreamSource src = new StreamSource( xslStream );
                src.setSystemId( stylesheet );
                transformer = TransformerFactory.newInstance().newTransformer( src );
            } finally {
View Full Code Here

    }

    private SVGInterface createSVG(QName qName) {

        // generate new
        InputStream in = getBpelDescriptor(qName);

        SVGInterface svg = null;

        try {
            svg = BPEL2SVGUtil.generate(in);
View Full Code Here

        assertEquals(oldSize, currentWeek.getAll().size());
        assertEquals(oldSize, currentWeek.getInvalidAssignments().size());
    }

    private DataPool4Track2 createDP4Track2() {
        InputStream iStream = NoCollisionPrinciple.class.getResourceAsStream(TIM_FILE);
        assertNotNull(iStream);
        InputStreamReader reader = new InputStreamReader(iStream);
        DataPool4Track2 dataPool4Track2 = new DataPool4Track2();
        dataPool4Track2.setSettings(settings);
        dataPool4Track2.setDataPool(dataPool);
View Full Code Here

        assertEquals(Helper.countPattern(str, "root"), 2);
        assertEquals(Helper.countPattern(str, "element"), 1);
    }

    public void createJavaStringFromXMLString() throws Exception {
        InputStream is = getClass().getResourceAsStream(
                "HelperTestFormattingFile.xml");
        StringWriter sw = new StringWriter();
        Helper.readStreamIntoWriter(is, sw);
        String str = sw.toString();
View Full Code Here

  private static Log log = LogFactory.getLog(ConfigUtils.class);

  public static Properties loadProperties(String resourceName)
  {
    Properties properties = new Properties();
    InputStream stream = ConfigUtils.class.getResourceAsStream(resourceName);

    try
    {
      properties.load(stream);
    }
View Full Code Here

TOP

Related Classes of java.io.InputStream

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.