use of org.eclipse.wst.sse.core.internal.encoding.util.BufferedLimitedReader in project webtools.sourceediting by eclipse.
the class JSPDocumentLoader method getEmbeddedType.
/**
* Determine the MIME content type specified in a page directive. This
* should appear "as early as possible in the JSP page" according to the
* JSP v1.2 specification.
*/
private EmbeddedTypeHandler getEmbeddedType(IFile file) throws UnsupportedEncodingException, CoreException, IOException {
EmbeddedTypeHandler handler = null;
if (fFullPreparedReader == null) {
handler = getJSPDefaultEmbeddedType();
} else {
String mimeType = null;
IDocumentCharsetDetector jspProvider = getDocumentEncodingDetector();
Reader fullPreparedReader = getFullPreparedReader();
BufferedLimitedReader limitedReader = new BufferedLimitedReader(fullPreparedReader, CodedIO.MAX_BUF_SIZE);
jspProvider.set(limitedReader);
if (jspProvider instanceof IJSPHeadContentDetector) {
mimeType = ((IJSPHeadContentDetector) jspProvider).getContentType();
fullPreparedReader.reset();
}
EmbeddedTypeRegistry reg = getEmbeddedContentTypeRegistry();
if (mimeType == null || mimeType.length() == 0) {
handler = getJSPDefaultEmbeddedType();
} else {
handler = reg.getTypeFor(mimeType);
}
}
return handler;
}
Aggregations