for (int i = 0; i < numFiles; i++) {
expectHeader(input, DomainControllerProtocol.FILE_START);
expectHeader(input, DomainControllerProtocol.PARAM_FILE_PATH);
final String path = input.readUTF();
expectHeader(input, DomainControllerProtocol.PARAM_FILE_SIZE);
final long length = input.readLong();
log.debugf("Received file [%s] of length %d", path, length);
final File file = new File(localPath, path);
if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
throw new IOException("Unable to create local directory " + localPath.getParent());
}