Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjOutputException


    write(b, 0, b.length);
  }

  @Override
  public void write(int b) throws IOException {
    throw new PngjOutputException("should not be used");
  }
View Full Code Here


   *
   * @param os
   */
  public void reset(OutputStream os) {
    if (closed)
      throw new PngjOutputException("cannot reset, discarded object");
    done();
    bytesIn = 0;
    bytesOut = 0;
    block = -1;
    done = false;
View Full Code Here

  public void flush() {
    if (os != null)
      try {
        os.flush();
      } catch (IOException e) {
        throw new PngjOutputException(e);
      }
  }
View Full Code Here

   **/
  private static boolean shouldWrite(PngChunk c, int currentGroup) {
    if (currentGroup == CHUNK_GROUP_2_PLTE)
      return c.id.equals(ChunkHelper.PLTE);
    if (currentGroup % 2 == 0)
      throw new PngjOutputException("bad chunk group?");
    int minChunkGroup, maxChunkGroup;
    if (c.getOrderingConstraint().mustGoBeforePLTE())
      minChunkGroup = maxChunkGroup = ChunksList.CHUNK_GROUP_1_AFTERIDHR;
    else if (c.getOrderingConstraint().mustGoBeforeIDAT()) {
      maxChunkGroup = ChunksList.CHUNK_GROUP_3_AFTERPLTE;
View Full Code Here

    while (it.hasNext()) {
      PngChunk c = it.next();
      if (!shouldWrite(c, currentGroup))
        continue;
      if (ChunkHelper.isCritical(c.id) && !c.id.equals(ChunkHelper.PLTE))
        throw new PngjOutputException("bad chunk queued: " + c);
      if (alreadyWrittenKeys.containsKey(c.id) && !c.allowsMultiple())
        throw new PngjOutputException("duplicated chunk does not allow multiple: " + c);
      c.write(os);
      chunks.add(c);
      alreadyWrittenKeys.put(c.id, alreadyWrittenKeys.containsKey(c.id) ? alreadyWrittenKeys.get(c.id) + 1 : 1);
      c.setChunkGroup(currentGroup);
      it.remove();
View Full Code Here

   *
   * Note that this is only used for non
   */
  public void writeChunk(OutputStream os) {
    if (idbytes.length != 4)
      throw new PngjOutputException("bad chunkid [" + ChunkHelper.toString(idbytes) + "]");
    PngHelperInternal.writeInt4(os, len);
    PngHelperInternal.writeBytes(os, idbytes);
    if (len > 0)
      PngHelperInternal.writeBytes(os, data, 0, len);
    computeCrcForWriting();
View Full Code Here

TOP

Related Classes of ar.com.hjg.pngj.PngjOutputException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.