Methods Summary |
---|
public java.lang.Object | clone()
// File instance is considered immutable
// No need to make a copy of it
return super.clone();
|
public java.io.InputStream | getContent()
return new FileInputStream(this.file);
|
public long | getContentLength()
return this.file.length();
|
public boolean | isRepeatable()
return true;
|
public boolean | isStreaming()Tells that this entity is not streaming.
return false;
|
public void | writeTo(java.io.OutputStream outstream)
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
InputStream instream = new FileInputStream(this.file);
try {
byte[] tmp = new byte[4096];
int l;
while ((l = instream.read(tmp)) != -1) {
outstream.write(tmp, 0, l);
}
outstream.flush();
} finally {
instream.close();
}
|