Class TextBuilder

java.lang.Object
pixy.image.png.ChunkBuilder
pixy.image.png.TextBuilder
All Implemented Interfaces:
Builder<Chunk>

public class TextBuilder
extends ChunkBuilder
implements Builder<Chunk>
Builder for PNG textual chunks: iTXT, zTXT, and tEXT.
Version:
1.0 12/31/2012
Author:
Wen Yu, yuwen_66@yahoo.com
  • Constructor Summary

    Constructors 
    Constructor Description
    TextBuilder​(ChunkType chunkType)  
  • Method Summary

    Modifier and Type Method Description
    protected byte[] buildData()  
    TextBuilder keyword​(java.lang.String keyword)
    The keyword must be at least one character and less than 80 characters long.
    void setCompressed​(boolean compressed)  
    TextBuilder text​(java.lang.String text)
    The tExt chunk is interpreted according to the ISO/IEC 8859-1 (Latin-1) character set [ISO/IEC-8859-1].

    Methods inherited from class pixy.image.png.ChunkBuilder

    build, getChunkType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface pixy.util.Builder

    build
  • Constructor Details

  • Method Details

    • buildData

      protected byte[] buildData()
      Specified by:
      buildData in class ChunkBuilder
    • keyword

      public TextBuilder keyword​(java.lang.String keyword)
      The keyword must be at least one character and less than 80 characters long.

      Keywords are always interpreted according to the ISO/IEC 8859-1 (Latin-1) character set [ISO/IEC-8859-1].

      They must contain only printable Latin-1 characters and spaces; that is, only character codes 32-126 and 161-255 decimal are allowed.

      To reduce the chances for human misreading of a keyword, leading and trailing spaces are forbidden, as are consecutive spaces.

      Note also that the non-breaking space (code 160) is not permitted in keywords, since it is visually indistinguishable from an ordinary space.

    • setCompressed

      public void setCompressed​(boolean compressed)
    • text

      public TextBuilder text​(java.lang.String text)
      The tExt chunk is interpreted according to the ISO/IEC 8859-1 (Latin-1) character set [ISO/IEC-8859-1]. The text string can contain any Latin-1 character. Newlines in the text string should be represented by a single line feed character (decimal 10); use of other control characters in the text is discouraged.

      The zTXt chunk contains textual data, just as tEXt does; however, zTXt takes advantage of compression. The zTXt and tEXt chunks are semantically equivalent, but zTXt is recommended for storing large blocks of text. A zTXt chunk contains: Keyword: 1-79 bytes (character string) Null separator: 1 byte Compression method: 1 byte Compressed text: n bytes

      iTXt International textual data This chunk is semantically equivalent to the tEXt and zTXt chunks, but the textual data is in the UTF-8 encoding of the Unicode character set instead of Latin-1. This chunk contains: Keyword: 1-79 bytes (character string) Null separator: 1 byte Compression flag: 1 byte Compression method: 1 byte Language tag: 0 or more bytes (character string) Null separator: 1 byte Translated keyword: 0 or more bytes Null separator: 1 byte Text: 0 or more bytes