HtmlBlock (RabbIT/4)
Date: 2009-12-20

Overview | Package | Class | Use | 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 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).

Author:
  Robert Olofsson

Constructor Summary
`HtmlBlock(char[] page, int length, Charset cs, byte[] decodeRest)` Create a HtmlBLock from the given byte array.

Method Summary
`void` | `addToken(Token t)` Add a Token to this block.
`List<ByteBuffer>` | `getBlocks()`
`byte[]` | `getRestBlock()` Get the rest as a byte[]
`List<Token>` | `getTokens()` Get a List of the Tokens.
`boolean` | `hasMoreTokens()` Does this block have more tokens?
`boolean` | `hasRests()` Check if this block has any rest data, that is bytes that will not be used.
`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.
`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

### HtmlBlock

    public HtmlBlock(char[] page,
                     int length,
                     Charset cs,
                     byte[] decodeRest)

  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.

### hasRests

    public boolean hasRests()

  Check if this block has any rest data, that is bytes that will not be used.

### getRestBlock

    public byte[] getRestBlock()

  Get the rest as a byte[]

### 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 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 String toString()

  Get a String representation of this block.

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

### getBlocks

    public List<ByteBuffer> getBlocks()

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