|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.html.HtmlBlock
public class HtmlBlock
This class is used to describe a piece of a HTML page. A block is composed of Tokens and a rest (unparseable data, unfinished tags etc).
Constructor Summary | |
---|---|
HtmlBlock(byte[] page,
int length)
Create a HtmlBLock from the given byte array. |
Method Summary | |
---|---|
void |
addToken(Token t)
Add a Token to this block. |
List<ByteBuffer> |
getBlocks()
|
String |
getRest()
Get the rest of this block. |
ByteBuffer |
getRestBuffer()
|
List<Token> |
getTokens()
Get a List of the Tokens. |
boolean |
hasMoreTokens()
Does this block have more tokens? |
void |
insertRest(byte[] b)
Copy the rest into the given byte array. |
void |
insertToken(Token t,
int pos)
Insert a token at given position. |
Token |
nextToken()
Get the next Token. |
void |
removeToken(int pos)
Remove a Token at the given position. |
int |
restSize()
Get the number of bytes that the rest is. |
void |
send(OutputStream out)
Send this block (but not the rest part) on the given stream. |
void |
sendRest(OutputStream out)
Send the rest of the data on the given stream. |
void |
setRest(int reststart)
Set the rest of the page to start at given position. |
String |
toString()
Get a String representation of this block. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HtmlBlock(byte[] page, int length)
page
- the byte array that is the real pageMethod Detail |
---|
public void setRest(int reststart)
reststart
- the new index of the rest of the page.public String getRest()
public int restSize()
public void insertRest(byte[] b)
b
- the byte array to copy the rest into.public void addToken(Token t)
t
- the Token to add.public boolean hasMoreTokens()
public Token nextToken()
public List<Token> getTokens()
public void insertToken(Token t, int pos)
t
- the Token to insert.pos
- the position to insert the token at.public void removeToken(int pos)
pos
- the position of the token to remove.public String toString()
toString
in class Object
public void send(OutputStream out) throws IOException
out
- the Stream to send the data on.
IOException
- if writing the data fails.public List<ByteBuffer> getBlocks()
public void sendRest(OutputStream out) throws IOException
out
- the Stream to send the data on.
IOException
- if writing the data fails.public ByteBuffer getRestBuffer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |