// Path: Source/src/de/tum/in/www1/jReto/Connection.java
// public static interface DataProvider {
// 	ByteBuffer getData(int offset, int length);
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/packet/DataPacket.java
// public class DataPacket implements Packet {
// 	public final static PacketType TYPE = PacketType.DATA_PACKET;
// 	public final static int MINIMUM_LENGTH = Constants.PACKET_TYPE_SIZE;
// 	
// 	public final ByteBuffer data;
// 
// 	public DataPacket(ByteBuffer data) {
// 		this.data = data;
// 	}
// 	
// 	public static DataPacket deserialize(ByteBuffer data) {
// 		DataReader reader = new DataReader(data);
// 		if (!DataChecker.check(reader, TYPE, MINIMUM_LENGTH)) return null;
// 		
// 		return new DataPacket(reader.getRemainingData());
// 	}
// 	public ByteBuffer serialize() {
// 		DataWriter data = new DataWriter(MINIMUM_LENGTH + this.data.remaining());
// 		data.add(TYPE);
// 		data.add(this.data);
// 		return data.getData();
// 	}
// }


import java.nio.ByteBuffer;
import java.util.UUID;
import de.tum.in.www1.jReto.Connection.DataProvider;
import de.tum.in.www1.jReto.connectivity.packet.DataPacket;
package de.tum.in.www1.jReto.connectivity;



/**
* An OutTransfer represents a data transfer from the local peer to a remote peer. You can obtain one by calling the connection's send method.
*/
public class OutTransfer extends Transfer {
	private DataProvider dataSource;
	
	public OutTransfer(TransferManager transferManager, int dataLenght, DataProvider dataSource, UUID identifier) {
		super(transferManager, dataLenght, identifier);
		this.dataSource = dataSource;
	}
	
	public DataProvider getDataSource() {
		return this.dataSource;
	}
	
// Path: Source/src/de/tum/in/www1/jReto/Connection.java
// public static interface DataProvider {
// 	ByteBuffer getData(int offset, int length);
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/packet/DataPacket.java
// public class DataPacket implements Packet {
// 	public final static PacketType TYPE = PacketType.DATA_PACKET;
// 	public final static int MINIMUM_LENGTH = Constants.PACKET_TYPE_SIZE;
// 	
// 	public final ByteBuffer data;
// 
// 	public DataPacket(ByteBuffer data) {
// 		this.data = data;
// 	}
// 	
// 	public static DataPacket deserialize(ByteBuffer data) {
// 		DataReader reader = new DataReader(data);
// 		if (!DataChecker.check(reader, TYPE, MINIMUM_LENGTH)) return null;
// 		
// 		return new DataPacket(reader.getRemainingData());
// 	}
// 	public ByteBuffer serialize() {
// 		DataWriter data = new DataWriter(MINIMUM_LENGTH + this.data.remaining());
// 		data.add(TYPE);
// 		data.add(this.data);
// 		return data.getData();
// 	}
// }


// Path: Source/src/de/tum/in/www1/jReto/connectivity/OutTransfer.java
import java.nio.ByteBuffer;
import java.util.UUID;
import de.tum.in.www1.jReto.Connection.DataProvider;
import de.tum.in.www1.jReto.connectivity.packet.DataPacket;

package de.tum.in.www1.jReto.connectivity;



/**
* An OutTransfer represents a data transfer from the local peer to a remote peer. You can obtain one by calling the connection's send method.
*/
public class OutTransfer extends Transfer {
	private DataProvider dataSource;
	
	public OutTransfer(TransferManager transferManager, int dataLenght, DataProvider dataSource, UUID identifier) {
		super(transferManager, dataLenght, identifier);
		this.dataSource = dataSource;
	}
	
	public DataProvider getDataSource() {
		return this.dataSource;
	}
	
	DataPacket nextPacket(int length) {