Example usage for javax.activation URLDataSource getInputStream

List of usage examples for javax.activation URLDataSource getInputStream

Introduction

In this page you can find the example usage for javax.activation URLDataSource getInputStream.

Prototype

public InputStream getInputStream() throws IOException 

Source Link

Document

The getInputStream method from the URL.

Usage

From source file:org.rebioma.server.FileUploadServlet.java

public static void main(String args[]) {
    try {//  w  ww  . ja  v  a 2s.  c  o m
        URLDataSource csvSource = new URLDataSource(
                new URL("https://sites.google.com/site/rebiomahelp/home/english#datause"));
        BufferedReader stream = new BufferedReader(new InputStreamReader(csvSource.getInputStream()));
        String line;
        while ((line = stream.readLine()) != null) {
            System.out.println(line);
        }
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.rebioma.server.FileUploadServlet.java

private InputStream getUrlInputStream(String url) throws IOException {
    URLDataSource csvSource = new URLDataSource(new URL(url));
    return csvSource.getInputStream();

}