public class URLHttpResource extends Object implements HttpResource
Constructor and Description |
---|
URLHttpResource(URL url)
construct a resource from a given input stream and a default buffer
size of 16384 for copying the stream to an output stream.
|
URLHttpResource(URL url,
int bufferSize)
construct a resource from a given input stream and a given buffer
size for copying the stream to an output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
getBufferSize() |
Date |
getLastModified() |
URL |
getUrl() |
boolean |
isReusable() |
boolean |
isUpdateable() |
long |
makeDigest(MessageDigest md) |
void |
readFromStream(InputStream is)
Update this resource from a stream.
|
void |
setWritePlacement(String regex,
String repl)
Configure a file name mapping for writing.
|
void |
writeToStream(OutputStream os)
Copy the resource to an output stream.
|
public URLHttpResource(URL url, int bufferSize)
url
- The URL representing the resourcebufferSize
- The buffer size.public URLHttpResource(URL url)
inputStream
- The stream representing the resource.public void setWritePlacement(String regex, String repl)
regex
- The regular expression to replace.repl
- The replacement.String.replaceFirst(String, String)
public void writeToStream(OutputStream os) throws IOException
HttpResource
writeToStream
in interface HttpResource
os
- The output stream to write to.IOException
- Upon I/O errors.public long makeDigest(MessageDigest md) throws IOException
makeDigest
in interface HttpResource
md
- A message digest to update with the contents of the
resource.IOException
- Upon I/O errors.public void readFromStream(InputStream is) throws IOException
HttpResource
HttpResource.isUpdateable()
returns
true
.readFromStream
in interface HttpResource
is
- The input stream to read the updated content from.IOException
public Date getLastModified()
getLastModified
in interface HttpResource
null
, if the last modification date is unknown.public boolean isUpdateable()
isUpdateable
in interface HttpResource
HttpResource.readFromStream(InputStream)
is implemented.public boolean isReusable()
isReusable
in interface HttpResource
HttpResource.writeToStream(OutputStream)
and/or
HttpResource.makeDigest(MessageDigest)
may be called
multiple times or the resource has to be resolved
each time it is going to be used.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public URL getUrl()
public int getBufferSize()
Copyright © 2018 Clazzes.org. All rights reserved.