15,6 → 15,7 |
*/ |
package net.brutex.xservices.ws.impl; |
|
import java.io.ByteArrayOutputStream; |
import java.io.File; |
import java.io.FileNotFoundException; |
import java.io.FileOutputStream; |
156,6 → 157,26 |
} |
} |
|
public byte[] encodeFile(FileResource res) throws XServicesFault { |
InputStream is = null; |
try { |
is = res.getAntResource(null).getInputStream(); |
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); |
|
int nRead; |
byte[] data = new byte[4096]; |
while ((nRead = is.read(data, 0, data.length)) != -1) { |
buffer.write(data, 0, nRead); |
} |
buffer.flush(); |
return buffer.toByteArray(); |
|
} catch (IOException e) { |
throw new XServicesFault(e); |
} |
} |
|
/* |
* (non-Javadoc) |
* |