Package java.util.zip

Examples of java.util.zip.DataFormatException


      }
      dstoff += n;
    }

    if (dstoff != sz) {
      throw new DataFormatException(MessageFormat.format(
          DhtText.get().shortCompressedObject,
          ChunkKey.fromString(meta.getFragment(0)),
          Integer.valueOf(pos)));
    }
    return dstbuf;
View Full Code Here


          pin(pack, position);
          position += window.setInput(position, inf);
        } else if (inf.finished())
          return dstoff;
        else
          throw new DataFormatException();
      }
      dstoff += n;
    } while (dstoff < dstbuf.length);
    return dstoff;
  }
View Full Code Here

        position += block.remaining(position);
        pin(pack, position);
      } else if (inf.finished())
        return dstoff;
      else
        throw new DataFormatException();
    }
  }
View Full Code Here

      throws DataFormatException {
    Inflater inflater = new Inflater(true);
    inflater.setInput(data, off, len);
    int size = inflater.inflate(out);
    if (size != out.length)
      throw new DataFormatException("unexpected size of deflated data: "
          + size + " instead of " + out.length);
  }
View Full Code Here

          block.setInput(inf, position);
          continue;
        }
        if (inf.finished())
          return dstoff;
        throw new DataFormatException();
      }
      dstoff += n;
    }
  }
View Full Code Here

          pin(pack, position);
          position += window.setInput(position, inf);
        } else if (inf.finished())
          return dstoff;
        else
          throw new DataFormatException();
      }
      dstoff += n;
    } while (dstoff < dstbuf.length);
    return dstoff;
  }
View Full Code Here

     */
    try
    {
      /* first byte is the type */
      if (in[0] != MSG_TYPE_WINDOW)
        throw new DataFormatException("input is not a valid Window Message");
      int pos = 1;

      /*
       * read the number of acks contained in this message.
       * first calculate the length then construct the string
       */
      int length = getNextLength(in, pos);
      String numAckStr = new String(in, pos, length, "UTF-8");
      pos += length +1;
      numAck = Integer.parseInt(numAckStr);
    } catch (UnsupportedEncodingException e)
    {
      throw new DataFormatException("UTF-8 is not supported by this jvm.");
    }
  }
View Full Code Here

  public ResetGenerationIdMsg(byte[] in) throws DataFormatException
  {
    try
    {
      if (in[0] != MSG_TYPE_RESET_GENERATION_ID)
        throw new
        DataFormatException("input is not a valid GenerationId Message");

      int pos = 1;

      /* read the generationId */
      int length = getNextLength(in, pos);
      generationId = Long.valueOf(new String(in, pos, length,
      "UTF-8"));
      pos += length +1;
    } catch (UnsupportedEncodingException e)
    {
      throw new DataFormatException("UTF-8 is not supported by this jvm.");
    }

  }
View Full Code Here

    super();
    try
    {
      // First byte is the type
      if (in[0] != MSG_TYPE_DONE)
        throw new DataFormatException("input is not a valid DoneMessage");
      int pos = 1;

      // sender
      int length = getNextLength(in, pos);
      String senderString = new String(in, pos, length, "UTF-8");
      this.senderID = Integer.valueOf(senderString);
      pos += length +1;

      // destination
      length = getNextLength(in, pos);
      String destinationString = new String(in, pos, length, "UTF-8");
      this.destination = Integer.valueOf(destinationString);
      pos += length +1;

    } catch (UnsupportedEncodingException e)
    {
      throw new DataFormatException("UTF-8 is not supported by this jvm.");
    }
  }
View Full Code Here

     * <msg-type>
     */

    /* first byte is the type */
    if (in.length != 1 || in[0] != MSG_TYPE_HEARTBEAT)
      throw new DataFormatException("Input is not a valid Heartbeat Message.");
  }
View Full Code Here

TOP

Related Classes of java.util.zip.DataFormatException

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.