text:
<?php

/**
 * DKIM Signer used to apply DKIM Signature to a message
 * Takes advantage of pecl extension or fallbacks to php implementation
 *
 * @package    Swift
 * @subpackage Signatures
 * @author     Xavier De Cock <xdecock@gmail.com>
 */

class Swift_Signer_PeclDKIMSigner extends Swift_Signers_DKIMSigner
{
    private $_peclLoaded = false;

    private $_dkimHandler = null;

    public function __construct($privateKey, $domainName, $selector)
    {
        parent::__construct($privateKey, $domainName, $selector);
        if (extension_loaded('dkim')) {
            $this->_peclLoaded = true;
        }
    }

    public function addSignature(Swift_Mime_HeaderSet $headers)
    {
        if (! $this->_peclLoaded) {
            return parent::addSignature($headers);
        } else {
            dkim_eom($this->_dkimHandler);
            $headers->addTextHeader('DKIM-Signature: ', dkim_getsighdr($this->_dkimHandler));
        }

        return $this;
    }

    public function setHeaders(Swift_Mime_HeaderSet $headers)
    {
        if (! $this->_peclLoaded) {
            return parent::setHeaders($headers);
        }
        //dkim_sign(privateKey, selector, domain[, header_canon[, body_canon[, sign_alg[, body_length]]]])
        $bodyLen = $this->_bodyLen();
        if (is_bool($bodyLen)) {
            $bodyLen = - 1;
        }
        $hash = ($this->_hashAlgorithm == 'rsa-sha1') ? DKIM_SIGN_RSASHA1 : DKIM_SIGN_RSASHA256;
        $bodyCanon = ($this->_bodyCanon == 'simple') ? DKIM_CANON_SIMPLE : DKIM_CANON_RELAXED;
        $headerCanon = ($this->_headerCanon == 'simple') ? DKIM_CANON_SIMPLE : DKIM_CANON_RELAXED;
        $this->_dkimHandler = dkim_sign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);

        $listHeaders = $headers->listAll();
        foreach ($listHeaders as $hName) {
            // Check if we need to ignore Header
            if (! isset($this->_ignoredHeaders[strtolower($hName)])) {
                $tmp = $headers->getAll($hName);
                if ($headers->has($hName)) {
                    foreach ($tmp as $header) {
                        if ($header->getFieldBody() != '') {
                            dkim_header($this->_dkimHandler, $header->toString());
                            $this->_signedHeaders[] = $header->getFieldName();
                        }
                    }
                }
            }
        }

        return $this;
    }

    public function startBody()
    {
        if (! $this->_peclLoaded) {
            return parent::startBody();
        }
        dkim_eoh($this->_dkimHandler);

        return $this;
    }

    public function endBody()
    {
        if (! $this->_peclLoaded) {
            return parent::endBody();
        }
        dkim_eob($this->_dkimHandler);

        return $this;
    }

    public function reset()
    {
        $this->_dkimHandler = null;
        parent::reset();
    }

    // Protected

    protected function _canonicalizeBody($string)
    {
        if (! $this->_peclLoaded) {
            return parent::_canonicalizeBody($string);
        }
        dkim_body($this->_dkimHandler, $string);
    }
}


text:
{% extends 'base.html' %}
{% block body %}

{% endblock body %}

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE OverloadedStrings #-}
import Snap.Http.Server (httpServe)
import Snap.Http.Server.Config (defaultConfig, setAccessLog, setErrorLog, setPort)
import Snap.Types (Snap, writeBS)

site :: Snap ()
site = writeBS "PONG"

main :: IO ()
main = do
  let config = setPort 8000 .
               setAccessLog Nothing .
               setErrorLog Nothing $
               defaultConfig
  httpServe config site


text:
package com.linkedin.pinot.core.operator.docidsets;

import com.linkedin.pinot.core.common.BlockDocIdSet;

public interface FilterBlockDocIdSet extends BlockDocIdSet {

  int getMinDocId();

  int getMaxDocId();

  void setStartDocId(int startDocId);

  void setEndDocId(int endDocId);

  long getNumEntriesScannedInFilter();
}


text:
package com.healthmarketscience.rmiio;

import java.io.IOException;
import java.io.OutputStream;

import com.healthmarketscience.rmiio.util.EncodingInputStream;

/**
 * Base class for implementing the server side of a RemoteIterator where the
 * objects need to be encoded on the fly.  This object sends objects to the
 * RemoteIteratorClient through the internal RemoteInputStreamServer as
 * needed.  Implementations of this class must implement the writeNextObject()
 * method, which should write the next object in the iteration to the local
 * output stream (which in turn will forward to data to the
 * RemoteIteratorClient).  An Implementation should override closeIterator()
 * to do cleanup (like flushing and closing the output stream) after the last
 * object has been sent.  The local output stream must only be written
 * during a call to writeNextObject() or closeIterator().  Note, users of this
 * class should ensure that the close() method is called one way or another,
 * or shutdown of the process may be delayed.
 *

 * Note, a real-time-ish iterator is available if compression is disabled and
 * noDelay is enabled (noDelay is ignored if compression is enabled).  This
 * will attempt to send objects across the wire ASAP, at the expense of more
 * wire traffic.
 *
 * @author James Ahlborn
 */
public abstract class EncodingRemoteIteratorServer<DataType>
  extends RemoteIteratorServer<DataType>
{
  /** the OutputStream which subclasses should use to write out an object
      during a call to writeNextObject() (and possibly closeIterator()). */
  protected OutputStream _localOStream;

  public EncodingRemoteIteratorServer()
    throws IOException
  {
    this(true, RemoteInputStreamServer.DUMMY_MONITOR);
  }

  public EncodingRemoteIteratorServer(boolean useCompression)
    throws IOException
  {
    this(useCompression, false, RemoteInputStreamServer.DUMMY_MONITOR);
  }

  public EncodingRemoteIteratorServer(boolean useCompression,
                                      boolean noDelay)
    throws IOException
  {
    this(useCompression, noDelay, RemoteInputStreamServer.DUMMY_MONITOR);
  }

  public EncodingRemoteIteratorServer(
      boolean useCompression,
      RemoteStreamMonitor<RemoteInputStreamServer> monitor)
    throws IOException
  {
    this(useCompression, false, monitor);
  }

  public EncodingRemoteIteratorServer(
      boolean useCompression,
      boolean noDelay,
      RemoteStreamMonitor<RemoteInputStreamServer> monitor)
    throws IOException
  {
    this(useCompression, noDelay, monitor,
         RemoteInputStreamServer.DEFAULT_CHUNK_SIZE);
  }

  @SuppressWarnings("unchecked")
  public EncodingRemoteIteratorServer(
      boolean useCompression,
      boolean noDelay,
      RemoteStreamMonitor<RemoteInputStreamServer> monitor,
      int chunkSize)
    throws IOException
  {
    // note, noDelay makes no sense if we are using compression, so just
    // disable in that case (this is not techically incorrect, compression
    // just overrides noDelay)
    super(new EncodingInputStreamImpl<DataType>(chunkSize, (noDelay && !useCompression)),
          useCompression, monitor, chunkSize);
    ((EncodingInputStreamImpl<DataType>)_localIStream).setOuter(this);
    _localOStream = ((EncodingInputStreamImpl<DataType>)_localIStream).getOutputStream();
  }

  /**
   * Closes any resources held by this iterator.  Subclasses should
   * flush/close OutputStream during this call.
   */
  protected void closeIterator()
    throws IOException
  {
    _localOStream.close();
  }

  /**
   * If there are more objects in the iteration, writes an object to the
   * _localOStream and returns true, otherwise returns
   * false.
   */
  protected abstract boolean writeNextObject()
    throws IOException;

  /**
   * InputStream which lies under the RemoteInputStream and "reads" objects as
   * necessary when data is requested by the client.  the _localOStream used
   * by the implementation of the EncodingRemoteIteratorServer actually
   * forwards data to this class, which fills a buffer passed in during a
   * read() call (and possibly an overflow buffer if necessary).
   */
  private static class EncodingInputStreamImpl<DTypeOuter> extends EncodingInputStream
  {
    /** because of the way things are created, this class cannot be an inner
        class.  instead, we get a reference to our outer class after initial
        construction. */
    private EncodingRemoteIteratorServer<DTypeOuter> _outer;

    private EncodingInputStreamImpl(int chunkSize, boolean noDelay) {
      super(chunkSize, noDelay);
    }

    private void setOuter(EncodingRemoteIteratorServer<DTypeOuter> outer) {
      _outer = outer;
    }

    private OutputStream getOutputStream() {
      return createOutputStream();
    }

    @Override
    public void encode(int suggestedLength)
      throws IOException
    {
      if(!_outer.writeNextObject()) {
        // this call should close the OutputStream
        _outer.closeIterator();
      }
    }

  }

}


text:
package org.camunda.bpm.engine.rest.dto.task;

public class UserIdDto {

  private String userId;

  public String getUserId() {
    return userId;
  }

  public void setUserId(String userId) {
    this.userId = userId;
  }
}


text:
package com.palantir.giraffe.host;

import java.io.IOException;

/**
 * Checked exception thrown when authentication fails.
 *
 * @author bkeyes
 */
public class AuthenticationException extends IOException {

    /**
     * Creates an exception with the specified hostname and detail message.
     *
     * @param hostname the hostname of the host on which authentication failed
     * @param message the detail message
     */
    public AuthenticationException(String hostname, String message) {
        this(hostname, message, null);
    }

    /**
     * Creates an exception with the specified hostname, detail message, and
     * cause.
     *
     * @param hostname the hostname of the host on which authentication failed
     * @param message the detail message
     * @param cause the cause of the authentication failure
     */
    public AuthenticationException(String hostname, String message, Throwable cause) {
        super("failed to authenticate to " + hostname + ": " + message, cause);
    }

    private static final long serialVersionUID = 6184687007850310201L;
}