public class InputStreamHttpResource extends Object implements HttpResource
Constructor and Description |
---|
InputStreamHttpResource(InputStream inputStream)
construct a resource from a given input stream and a default buffer
size of 16384 for copying the stream to an output stream.
|
InputStreamHttpResource(InputStream inputStream,
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() |
InputStream |
getInputStream() |
Date |
getLastModified() |
boolean |
isReusable() |
boolean |
isUpdateable() |
long |
makeDigest(MessageDigest md) |
void |
readFromStream(InputStream is)
Update this resource from a stream.
|
void |
writeToStream(OutputStream os)
Copy the resource to an output stream.
|
public InputStreamHttpResource(InputStream inputStream, int bufferSize)
inputStream
- The stream representing the resource.bufferSize
- The buffer size.public InputStreamHttpResource(InputStream inputStream)
inputStream
- The stream representing the resource.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 InputStream getInputStream()
public int getBufferSize()
Copyright © 2018 Clazzes.org. All rights reserved.