Subversion Repositories XServices

Rev

Rev 94 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 97
Line 11... Line 11...
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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
 
-
 
17
 
-
 
18
package net.brutex.xservices.ws.impl;
16
package net.brutex.xservices.ws.impl;
Line 19... Line -...
19
 
-
 
20
import java.io.ByteArrayOutputStream;
17
 
21
import java.io.File;
18
import java.io.File;
22
import java.io.FileNotFoundException;
19
import java.io.FileNotFoundException;
23
import java.io.FileOutputStream;
20
import java.io.FileOutputStream;
24
import java.io.IOException;
21
import java.io.IOException;
Line 28... Line 25...
28
import javax.activation.DataHandler;
25
import javax.activation.DataHandler;
29
import javax.jws.WebMethod;
26
import javax.jws.WebMethod;
30
import javax.jws.WebParam;
27
import javax.jws.WebParam;
31
import javax.jws.WebService;
28
import javax.jws.WebService;
Line -... Line 29...
-
 
29
 
-
 
30
import net.brutex.xservices.types.ArchiveResource;
-
 
31
import net.brutex.xservices.types.AttachmentType;
-
 
32
import net.brutex.xservices.types.FileResource;
32
 
33
import net.brutex.xservices.types.FileSetResource;
33
import net.brutex.xservices.types.ReplacePattern;
34
import net.brutex.xservices.types.ReplacePattern;
34
import net.brutex.xservices.types.ReturnCode;
-
 
35
import net.brutex.xservices.types.ant.ArchiveResource;
-
 
36
import net.brutex.xservices.types.ant.AttachmentType;
-
 
37
import net.brutex.xservices.types.ant.FileResource;
-
 
38
import net.brutex.xservices.types.ant.FileSetResource;
35
import net.brutex.xservices.types.ReturnCode;
39
import net.brutex.xservices.util.BrutexNamespaces;
36
import net.brutex.xservices.util.BrutexNamespaces;
40
import net.brutex.xservices.util.RunTask;
37
import net.brutex.xservices.util.RunTask;
41
import net.brutex.xservices.ws.FileService;
38
import net.brutex.xservices.ws.FileService;
Line 157... Line 154...
157
		} catch (IOException e) {
154
		} catch (IOException e) {
158
			throw new XServicesFault(e);
155
			throw new XServicesFault(e);
159
		}
156
		}
160
	}
157
	}
Line 161... Line -...
161
	
-
 
162
	public byte[] encodeFile(FileResource res) throws XServicesFault {
-
 
163
		InputStream is = null;
-
 
164
		try {
-
 
165
			is = res.getAntResource(null).getInputStream();
-
 
166
		
-
 
167
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
 
168
 
-
 
169
		int nRead;
-
 
170
		byte[] data = new byte[4096];
-
 
171
		while ((nRead = is.read(data, 0, data.length)) != -1) {
-
 
172
		  buffer.write(data, 0, nRead);
-
 
173
		}
-
 
174
		buffer.flush();
-
 
175
		return buffer.toByteArray();
-
 
176
		
-
 
177
		} catch (IOException e) {
-
 
178
			throw new XServicesFault(e);
-
 
179
		}
-
 
180
	}
-
 
181
 
158
 
182
	/*
159
	/*
183
	 * (non-Javadoc)
160
	 * (non-Javadoc)
184
	 * 
161
	 * 
185
	 * @see
162
	 * @see