SocketDataProducer.java 1.15 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10
 */
11

Matt Tucker's avatar
Matt Tucker committed
12 13 14 15 16 17 18 19 20 21 22
package org.jivesoftware.net.spi;

import org.jivesoftware.net.Connection;

import java.io.InputStream;
import java.nio.ByteBuffer;

import org.jivesoftware.net.spi.BasicDataProducer;
import org.jivesoftware.net.Connection;

/**
23
 * Produces data from the input stream of a socket connection.
Matt Tucker's avatar
Matt Tucker committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
 *
 * @author Iain Shigeoka
 */
public class SocketDataProducer extends BasicDataProducer {

    private Connection conn;
    private InputStream in;

    /**
     * <p>Create a new socket producer for the given connection using
     * the provided input stream.</p>
     *
     * @param in The input stream to read from
     * @param connection The connection the data producer belongs to
     */
    SocketDataProducer(InputStream in, Connection connection){
        super();
        this.conn = connection;
        this.in = in;
    }

    protected ByteBuffer doProduction(long limit) {
        return super.doProduction(limit);
    }
}