Examples of HelloYenc


Examples of me.mabra.hellonzb.helloyenc.HelloYenc

  }

  public void run()
  {
    Vector<byte[]> outVector = new Vector<byte[]>();
    HelloYenc yencDecoder = null;
    UUDecoderStream uuDecoder = null;
    FileOutputStream fileOutStream = null;
    int uuLength = 0;

    // prepare suitable decoder
    if(encoding.equals("yenc"))
      yencDecoder = new HelloYenc(logger);
    else if(encoding.equals("uu"))
      uuDecoder = null;
    else
    {
      logger.msg("Could not find a suitable decoder!", MyLogger.SEV_ERROR);
      return;
    }

    try
    {
      int i = 0;
      while(articleData.size() > 0)
      {
        // check for corrupt download
        if(articleData.get(0) == null || articleData.get(0).length == 0)
        {
          logger.msg("FileDecoder: Corrupt data found", MyLogger.SEV_WARNING);
          articleData.remove(0);
          continue;
        }

        // set data input stream of the yenc decoder object
        if(encoding.equals("yenc"))
        {
          yencDecoder.setInputData(articleData.get(0));
          yencDecoder.setPartNum(i + 1);
          yencDecoder.setRunnable(this);
        }

        // set data for the UUDecoder object
        else if(encoding.equals("uu"))
        {
          byte[] src = articleData.get(0);
          uuLength = src.length;
          ByteArrayInputStream inStream = new ByteArrayInputStream(src);
          uuDecoder = new UUDecoderStream(inStream);
        }

        // do we have the first (yenc) part loaded (then get filename)?
        if(i == 0)
        {
          File resultFile = createOutFile(yencDecoder, uuDecoder);
          fileOutStream = new FileOutputStream(resultFile);
        }

        // now decode the current article data block
        if(articleData.get(0).length > 0)
        {
          if(encoding.equals("yenc"))
            outVector.add(yencDecoder.decode());

          else if(encoding.equals("uu"))
          {
            byte[] bytes = new byte[uuLength];
            int b;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.