Examples of YencException


Examples of me.mabra.hellonzb.helloyenc.YencException

    byte [] outBuf = new byte [inSize];
   
   
    // was this decoder already initialized?
    if(! initialized)
      throw new YencException("No data input vector set");
   
    // step through the input data
    for(int j = dataOffset; j < inSize; j++, byteCount++)
    {
      // read input character
      int i = (int) inputData[j];

      // skip end of line
      if(i == 10 || i == 13)
        continue;
       
      // check for escape character
      if(i == '=' && (j + 1) < inSize)
      {
        // parse footer
        try
        {
          if(inputData[j + 1] == 'y' && checkFooter(inputData, j))
            break;
        }
        catch(YencException ex)
        {
          runnable.crc32Error();
        }

        // decode a non-yenc-meta-character
        j++;
        i = (int) inputData[j];
        i = (i - 64) % 256;
      }
       
      // subtract the 42 offset and send the result to the output
      i = (i - 42) % 256;

      outBuf[outBufCounter++] = (byte) i;
      crc32Obj.update(i);
    }
   
    // create new output buffer as the first one will be too long,
    // because of the CR/LF chars in the original data
    byte [] newOutBuf = new byte[outBufCounter];
    System.arraycopy(outBuf, 0, newOutBuf, 0, outBufCounter);
   
    initialized = false;
   
    if(!footerFound)
      throw new YencException("No yenc footer found");
    else
      footerFound = false;
   
    return newOutBuf;
  }
View Full Code Here

Examples of me.mabra.hellonzb.helloyenc.YencException

    int idx = 0;
    String tmp = "";
   
   
    if(inputSize <= ybegin.length())
      throw new YencException("invalid header format");
   
    // check for existing and correctly formatted header line
    for(; idx < ybegin.length() && (in[idx] == 10 || in[idx] == 13); idx++);
    for(int i = 0; idx < ybegin.length(); idx++, i++)
    {
      if(in[idx] != ybegin.charAt(i))
        throw new YencException("invalid header format");
    }
   
    if(in[idx + 2] != 10 && in[idx + 2] != 13)
      idx = idx + 2;
   
View Full Code Here

Examples of me.mabra.hellonzb.helloyenc.YencException

   
    // check the crc32 checksum
    if(crc32Obj.getValue() != crc32ToLong(crc32))
    {
      logger.msg("CRC32 check failed", MyLogger.SEV_WARNING);
      throw new YencException("CRC32 error in yenc part " + partNum);
   
    else logger.msg("yenc CRC32 check ok", MyLogger.SEV_DEBUG);
   
    return true; // footer line found
  }
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.