|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgov.lanl.archive.rewrite.TextDocument
public class TextDocument
Class which wraps functionality for converting a Resource(InputStream + HTTP headers) into a StringBuilder, performing several common URL resolution methods against that StringBuilder, inserting arbitrary Strings into the page, and then converting the page back to a byte array.
| Field Summary | |
|---|---|
StringBuilder |
sb
the internal StringBuilder |
| Constructor Summary | |
|---|---|
TextDocument(Memento resource,
String pageUrl,
String captureDate,
ResultURIConverter uriConverter)
|
|
| Method Summary | |
|---|---|
void |
addBase()
|
byte[] |
getBytes()
|
String |
getCharSet()
|
String |
getJSIncludeString(String jsUrl)
|
String |
getResult()
|
void |
insertAtEndOfBody(String toInsert)
|
void |
insertAtStartOfBody(String toInsert)
|
void |
insertAtStartOfDocument(String toInsert)
|
void |
insertAtStartOfHead(String toInsert)
|
void |
readFully(InputStreamReader isr)
|
void |
resolveAllPageUrls()
Update all URLs inside the page, so they resolve correctly to absolute URLs within the Wayback service. |
void |
resolveASXRefUrls()
|
void |
resolveCSSUrls()
|
void |
resolvePageUrls()
Update URLs inside the page, so those URLs which must be correct at page load time resolve correctly to absolute URLs. |
void |
setCharSet(String charSet)
|
void |
setResultBytes(byte[] resultBytes)
|
void |
stripHTML()
|
void |
writeToOutputStream(OutputStream os)
Write the contents of the page to the client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public StringBuilder sb
| Constructor Detail |
|---|
public TextDocument(Memento resource,
String pageUrl,
String captureDate,
ResultURIConverter uriConverter)
resource - result - uriConverter - | Method Detail |
|---|
public void addBase()
public void resolvePageUrls()
public void resolveAllPageUrls()
public void resolveCSSUrls()
public void resolveASXRefUrls()
public void stripHTML()
public void readFully(InputStreamReader isr)
throws IOException
charSet -
IOException
public byte[] getBytes()
throws UnsupportedEncodingException
UnsupportedEncodingException
public String getResult()
throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic void setResultBytes(byte[] resultBytes)
public void writeToOutputStream(OutputStream os)
throws IOException
os -
IOExceptionpublic void insertAtStartOfDocument(String toInsert)
toInsert - public void insertAtStartOfHead(String toInsert)
toInsert - public void insertAtEndOfBody(String toInsert)
toInsert - public void insertAtStartOfBody(String toInsert)
toInsert - public String getJSIncludeString(String jsUrl)
jsUrl -
public String getCharSet()
public void setCharSet(String charSet)
charSet - the charSet to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||