Subversion Repositories XServices

Rev

Rev 83 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83 Rev 92
Line 13... Line 13...
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
package net.brutex.xservices.ws.impl;
16
package net.brutex.xservices.ws.impl;
Line -... Line 17...
-
 
17
 
17
 
18
import java.io.ByteArrayOutputStream;
18
import java.io.File;
19
import java.io.File;
19
import java.io.FileNotFoundException;
20
import java.io.FileNotFoundException;
20
import java.io.FileOutputStream;
21
import java.io.FileOutputStream;
21
import java.io.IOException;
22
import java.io.IOException;
Line 153... Line 154...
153
			return t;
154
			return t;
154
		} catch (IOException e) {
155
		} catch (IOException e) {
155
			throw new XServicesFault(e);
156
			throw new XServicesFault(e);
156
		}
157
		}
157
	}
158
	}
-
 
159
	
-
 
160
	public byte[] encodeFile(FileResource res) throws XServicesFault {
-
 
161
		InputStream is = null;
-
 
162
		try {
-
 
163
			is = res.getAntResource(null).getInputStream();
-
 
164
		
-
 
165
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
 
166
 
-
 
167
		int nRead;
-
 
168
		byte[] data = new byte[4096];
-
 
169
		while ((nRead = is.read(data, 0, data.length)) != -1) {
-
 
170
		  buffer.write(data, 0, nRead);
-
 
171
		}
-
 
172
		buffer.flush();
-
 
173
		return buffer.toByteArray();
-
 
174
		
-
 
175
		} catch (IOException e) {
-
 
176
			throw new XServicesFault(e);
-
 
177
		}
-
 
178
	}
Line 158... Line 179...
158
 
179
 
159
	/*
180
	/*
160
	 * (non-Javadoc)
181
	 * (non-Javadoc)
161
	 * 
182
	 *