org.crsh.text
Class ChunkBuffer

java.lang.Object
  extended by org.crsh.text.ChunkBuffer
All Implemented Interfaces:
Flushable, Serializable, Iterable<Chunk>, Consumer<Chunk>

public class ChunkBuffer
extends Object
implements Iterable<Chunk>, Serializable, Consumer<Chunk>

See Also:
Serialized Form

Field Summary
private  LinkedList<Chunk> chunks
          .
private  Style current
          .
private  Style next
          .
private  Consumer<Chunk> out
          Where we flush.
 
Constructor Summary
ChunkBuffer()
           
ChunkBuffer(Consumer<Chunk> out)
           
 
Method Summary
 ChunkBuffer append(char c)
           
 ChunkBuffer append(CharSequence s)
           
 ChunkBuffer append(CharSequence s, int start, int end)
           
 ChunkBuffer append(ChunkBuffer s)
           
 ChunkBuffer append(Iterable<?> data)
           
 ChunkBuffer append(Object... data)
           
 ChunkBuffer append(Object o)
           
 ChunkBuffer append(Style style)
           
 void clear()
           
 ChunkBuffer cls()
           
 boolean contains(Object o)
           
 boolean equals(Object obj)
           
 void flush()
           
 Class<Chunk> getConsumedType()
          Returns the class of the element generic type.
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<Chunk> iterator()
           
private  Text last()
           
 void provide(Chunk element)
          Provide an element.
 String toString()
           
 void write(Chunk chunk)
           
 void writeAnsiTo(Appendable appendable)
          Deprecated. 
 void writeTo(Consumer<Chunk> writer)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

chunks

private final LinkedList<Chunk> chunks
.


current

private Style current
.


next

private Style next
.


out

private final Consumer<Chunk> out
Where we flush.

Constructor Detail

ChunkBuffer

public ChunkBuffer()

ChunkBuffer

public ChunkBuffer(Consumer<Chunk> out)
Method Detail

iterator

public Iterator<Chunk> iterator()
Specified by:
iterator in interface Iterable<Chunk>

writeAnsiTo

@Deprecated
public void writeAnsiTo(Appendable appendable)
                 throws IOException
Deprecated. 

Throws:
IOException

append

public ChunkBuffer append(Iterable<?> data)
                   throws NullPointerException
Throws:
NullPointerException

append

public ChunkBuffer append(Object... data)
                   throws NullPointerException
Throws:
NullPointerException

cls

public ChunkBuffer cls()

append

public ChunkBuffer append(Style style)
                   throws NullPointerException
Throws:
NullPointerException

append

public ChunkBuffer append(char c)

append

public ChunkBuffer append(CharSequence s)

append

public ChunkBuffer append(CharSequence s,
                          int start,
                          int end)

last

private Text last()

getConsumedType

public Class<Chunk> getConsumedType()
Description copied from interface: Consumer
Returns the class of the element generic type.

Specified by:
getConsumedType in interface Consumer<Chunk>
Returns:
the consumed type

provide

public void provide(Chunk element)
             throws IOException
Description copied from interface: Consumer
Provide an element.

Specified by:
provide in interface Consumer<Chunk>
Parameters:
element - the provided element
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Throws:
IOException

append

public ChunkBuffer append(ChunkBuffer s)
                   throws NullPointerException
Throws:
NullPointerException

write

public void write(Chunk chunk)
           throws NullPointerException
Throws:
NullPointerException

append

public ChunkBuffer append(Object o)
                   throws NullPointerException
Throws:
NullPointerException

contains

public boolean contains(Object o)

isEmpty

public boolean isEmpty()

clear

public void clear()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

writeTo

public void writeTo(Consumer<Chunk> writer)
             throws IOException
Throws:
IOException


Copyright © 2014 eXo Platform SAS. All Rights Reserved.