1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.util;
|
3
|
|
import java.io.BufferedReader;
|
4
|
|
import java.io.InputStreamReader;
|
5
|
|
import java.io.IOException;
|
6
|
|
import java.io.InputStream;
|
7
|
|
|
8
|
|
/**
|
9
|
|
* Various utility methods for manipulating IO streams.
|
10
|
|
*
|
11
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
12
|
|
*
|
13
|
|
* @version $Id: IoUtil.java,v 1.1 2002/04/21 12:45:44 vmassol Exp $
|
14
|
|
*/
|
15
|
|
public class IoUtil {
|
16
|
|
/**
|
17
|
|
* Read all data in an Inpout stream and return them as a
|
18
|
|
* <code>String</code> object.
|
19
|
|
*
|
20
|
|
* @param theStream the input stream from which to read the data
|
21
|
|
* @return the string representation of the data
|
22
|
|
* @throws IOException if an error occurs during the read of data
|
23
|
|
*/
|
24
|
0
|
public static String getText(InputStream theStream) throws IOException {
|
25
|
0
|
StringBuffer sb = new StringBuffer();
|
26
|
0
|
BufferedReader input = new BufferedReader(new InputStreamReader(theStream));
|
27
|
0
|
char[] buffer = new char[2048];
|
28
|
0
|
int nb;
|
29
|
0
|
while (-1 != (nb = input.read(buffer, 0, 2048))){
|
30
|
0
|
sb.append(buffer, 0, nb);
|
31
|
|
}
|
32
|
0
|
input.close();
|
33
|
0
|
return sb.toString();
|
34
|
|
}
|
35
|
|
|
36
|
|
/**
|
37
|
|
* Various utility methods for manipulating IO streams.
|
38
|
|
*
|
39
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
40
|
|
*
|
41
|
|
* @version $Id: IoUtil.java,v 1.1 2002/04/21 12:45:44 vmassol Exp $
|
42
|
|
*/
|
43
|
0
|
public IoUtil() {
|
44
|
0
|
super();
|
45
|
|
}
|
46
|
|
}
|