* Convert saved context to stream for parsing
* @return stream from saved content
*/
public InputStream getContentAsStream() {
int length = 0;
FastBufferInputStream result = null;
String encoding = this.getCharacterEncoding() ;
/// byte[] content;
if (isUseStream()) {
try {
servletOutputStream.flush();
} catch (IOException ex) {
log.warn(Messages.getMessage(Messages.FLUSH_BUFFERED_STREAM_ERROR), ex);
}
/// content = byteStream.toByteArray();
result = new FastBufferInputStream(byteStream);
} else if (isUseWriter()) {
printWriter.flush();
printWriter.close();
length = stringWriter.getLength();
/// String stringContent = stringWriter.toString();
try {
FastBufferOutputStream stream = stringWriter.convertToOutputStream(encoding);
result = new FastBufferInputStream(stream);
/// content = stringContent.getBytes(encoding);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
log.warn(Messages.getMessage(Messages.UNSUPPORTED_ENCODING_WARNING));
FastBufferOutputStream stream = stringWriter.convertToOutputStream();
result = new FastBufferInputStream(stream);
/// content = stringContent.getBytes();
}
} else {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(Messages.NO_WRITER_CALLED_INFO));