first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
package javax.activation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
public class URLDataSource implements DataSource {
|
||||
private URL url = null;
|
||||
|
||||
private URLConnection url_conn = null;
|
||||
|
||||
public URLDataSource(URL paramURL) {
|
||||
this.url = paramURL;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
String str = null;
|
||||
try {
|
||||
if (this.url_conn == null)
|
||||
this.url_conn = this.url.openConnection();
|
||||
} catch (IOException e) {}
|
||||
if (this.url_conn != null)
|
||||
str = this.url_conn.getContentType();
|
||||
if (str == null)
|
||||
str = "application/octet-stream";
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.url.getFile();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.url.openStream();
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
this.url_conn = this.url.openConnection();
|
||||
if (this.url_conn != null) {
|
||||
this.url_conn.setDoOutput(true);
|
||||
return this.url_conn.getOutputStream();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL getURL() {
|
||||
return this.url;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue