Class SitemeshBufferFragment

java.lang.Object
com.opensymphony.module.sitemesh.SitemeshBufferFragment

public class SitemeshBufferFragment extends Object
A fragment of a sitemesh buffer. This includes a start and a length, and may contain a list of deleted sections of the buffer.
  • Constructor Details

    • SitemeshBufferFragment

      public SitemeshBufferFragment(SitemeshBuffer buffer, int start, int length)
      Instantiates a new sitemesh buffer fragment.
      Parameters:
      buffer - the buffer
      start - the start
      length - the length
    • SitemeshBufferFragment

      public SitemeshBufferFragment(SitemeshBuffer buffer, int start, int length, TreeMap<Integer,Integer> deletions)
      Create a sitemesh buffer fragment.
      Parameters:
      buffer - The buffer that this is a fragment of
      start - The start of the fragment
      length - The length of the fragment
      deletions - Deleted parts of the fragment, as a map of positions to the length to be deleted.
  • Method Details

    • writeTo

      public void writeTo(Writer writer) throws IOException
      Write the fragment to the given writer.
      Parameters:
      writer - The writer to write the fragment to
      Throws:
      IOException - If an error occured
    • getTotalLength

      public int getTotalLength()
      Get the total length of the fragment, taking deletions and chained buffers of the buffer.
      Returns:
      The total length of the fragment
    • getStringContent

      public String getStringContent()
      Gets the string content.
      Returns:
      the string content
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getStart

      public int getStart()
      Gets the start.
      Returns:
      the start
    • getLength

      public int getLength()
      Gets the length.
      Returns:
      the length
    • builder

      public static SitemeshBufferFragment.Builder builder()
      Builder.
      Returns:
      the builder
    • builder

      public static SitemeshBufferFragment.Builder builder(SitemeshBufferFragment fragment)
      Builder.
      Parameters:
      fragment - the fragment
      Returns:
      the builder