Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 91 → Rev 92

/xservices/trunk/src/java/net/brutex/xservices/ws/impl/FileServiceImpl.java
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;
155,7 → 156,27
throw new XServicesFault(e);
}
}
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)
*