It works excellent.
Thanks.
Sanjay Acharya escribió:
Maybe you could create a simple stream representation to handle the same and
pass in an InputStream.
public class StreamRepresentation extends OutputRepresentation {
private InputStream in;
/**
* Accepts a Media Type.
*
* @param stream A non [EMAIL PROTECTED] null} input stream
* @param mediaType Media Type to use
*/
public SimpleStreamRepresentation(InputStream stream, MediaType mediaType) {
super(mediaType);
if (stream == null) {
throw new IllegalArgumentException("Illegal invocation. A valid non-null
instance of java.io.InputStream is required");
}
this.in = stream;
}
@Override public void write(OutputStream outputStream) throws IOException {
try {
IOUtils.copy(in, outputStream);
} finally {
try {
in.close();
} catch (IOException ioe) {
log.error("Unable to close Input Stream.", ioe);
}
in = null;
}
}
}
----------------------------------------
Date: Tue, 24 Jun 2008 14:55:56 -0500
From: [EMAIL PROTECTED]
To: [email protected]
Subject: Problem with FileRepresentation
In the API for FileRepresentation says that I can build one only with a
File or a StringPath, can I build a FileRepresentation with a stream?
This is because I dont want to acces the hard disk to get the File to be
represented.
Javier
_________________________________________________________________
The other season of giving begins 6/24/08. Check out the i’m Talkathon.
http://www.imtalkathon.com?source=TXT_EML_WLH_SeasonOfGiving