}
if (data == null || data.length == 0) {
// received none -> error
throw new StreamException("Packet contained no data");
}
if (transferDescription.type.equals(FileTransferType.STREAM_DATA)
&& data.length != streamPath.size) {
if (streamPath.size > data.length) {
log.error("Lost bytes! Got " + data.length + ", expected "
+ streamPath.size);
throw new StreamException(
"Received less data than announced.");
}
byte[] new_data = new byte[streamPath.size];
System.arraycopy(data, 0, new_data, 0, streamPath.size);
data = new_data;