Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.html
Class HTMLBlock

    java.lang.Object
      rabbit.html.HTMLBlock

    public class HTMLBlock

extends java.lang.Object

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.
`java.lang.String` | `getRest()` Get the rest of this block.
`java.util.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(java.io.OutputStream out)` Send this block (but not the rest part) on the given stream.
`void` | `sendRest(java.io.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.
`java.lang.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

### HTMLBlock

    public HTMLBlock(byte[] page,
                     int length)

  Create a HTMLBLock from the given byte array.

  Parameters:
    `page` - the byte array that is the real page

Method Detail

### setRest

    public void setRest(int reststart)

  Set the rest of the page to start at given position.

  Parameters:
    `reststart` - the new index of the rest of the page.

### getRest

    public java.lang.String getRest()

  Get the rest of this block.

  Returns:
    the rest part of the block

### restSize

    public int restSize()

  Get the number of bytes that the rest is.

  Returns:
    the length of the rest.

### insertRest

    public void insertRest(byte[] b)

  Copy the rest into the given byte array.

  Parameters:
    `b` - the byte array to copy the rest into.

### addToken

    public void addToken(Token t)

  Add a Token to this block.

  Parameters:
    `t` - the Token to add.

### hasMoreTokens

    public boolean hasMoreTokens()

  Does this block have more tokens?

  Returns:
    true if there is unfetched tokens, false otherwise.

### nextToken

    public Token nextToken()

  Get the next Token.

  Returns:
    the next Token or null if there are no more tokens.

### getTokens

    public java.util.List<Token> getTokens()

  Get a List of the Tokens.

  Returns:
    a List with the Tokens for this block.

### insertToken

    public void insertToken(Token t,
                            int pos)

  Insert a token at given position.

  Parameters:
    `t` - the Token to insert.
    `pos` - the position to insert the token at.

### removeToken

    public void removeToken(int pos)

  Remove a Token at the given position.

  Parameters:
    `pos` - the position of the token to remove.

### toString

    public java.lang.String toString()

  Get a String representation of this block.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a String with the content of this block.

### send

    public void send(java.io.OutputStream out)
              throws java.io.IOException

  Send this block (but not the rest part) on the given stream.

  Parameters:
    `out` - the Stream to send the data on.
  Throws:
    `java.io.IOException` - if writing the data fails.

### sendRest

    public void sendRest(java.io.OutputStream out)
                  throws java.io.IOException

  Send the rest of the data on the given stream.

  Parameters:
    `out` - the Stream to send the data on.
  Throws:
    `java.io.IOException` - if writing the data fails.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD