mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
Added a getContentLength() method to URLConnection
This is particularly important if you want to get the number of bytes of a resource loaded by the class loader: getClass().getResource("myFile").openConnection().getContentLength()
This commit is contained in:
@ -100,6 +100,10 @@ public final class URL {
|
||||
super(url);
|
||||
}
|
||||
|
||||
public int getContentLength() {
|
||||
return ResourceInputStream.getContentLength(url.getFile());
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ResourceInputStream(url.getFile());
|
||||
}
|
||||
@ -116,6 +120,8 @@ public final class URL {
|
||||
}
|
||||
}
|
||||
|
||||
private static native int getContentLength(String path);
|
||||
|
||||
private static native long open(String path) throws IOException;
|
||||
|
||||
private static native int read(long peer, int position) throws IOException;
|
||||
|
Reference in New Issue
Block a user