Starts downloading
@throws IOException if the file could not downloaded
181848
public void execute() throws IOException {
        if (GradleVersion.current().compareTo(MIN_GRADLE_VERSION) < 0 && !quiet) {
            project.getLogger().warn("Support for running gradle-download-task "
                    + "with Gradle 1.x has been deprecated and will be removed in "
                    + "gradle-download-task 4.0.0");
        }
        if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_7) < 0 && !quiet) {
            project.getLogger().warn("Support for running gradle-download-task "
                    + "using Java 6 has been deprecated and will be removed in "
                    + "gradle-download-task 4.0.0");
        }

        if (sources.isEmpty()) {
            throw new IllegalArgumentException("Please provide a download source");
        }
        if (dest == null) {
            throw new IllegalArgumentException("Please provide a download destination");
        }

        if (dest.equals(project.getBuildDir())) {
            //make sure build dir exists
            dest.mkdirs();
        }
        
        if (sources.size() > 1 && !dest.isDirectory()) {
            if (!dest.exists()) {
                // create directory automatically
                dest.mkdirs();
            } else {
                throw new IllegalArgumentException("If multiple sources are provided "
                        + "the destination has to be a directory.");
            }
        }
        
        CachingHttpClientFactory clientFactory = new CachingHttpClientFactory();
        try {
            for (URL src : sources) {
                execute(src, clientFactory);
            }
        } finally {
            clientFactory.close();
        }
    }
534910
public void open() throws IOException {
        mConnection.connect();
        mContentType = mConnection.getContentType();
        mResponseCode = mConnection.getResponseCode();
        mContentEncoding = mConnection.getContentEncoding();
    }
312392
public void startPacket()
        throws IOException
    {
        if (_refs != null) {
            _refs.clear();
            _refCount = 0;
        }

        flushBuffer();

        _isPacket = true;
        _offset = 4;
        _buffer[0] = (byte) 0x05; // 0x05 = binary
        _buffer[1] = (byte) 0x55;
        _buffer[2] = (byte) 0x55;
        _buffer[3] = (byte) 0x55;
    }
362002
public void start() {
		System.out.println(new LogEntry("starting root console"));
		try {
			openFileReader();
		} catch (IOException ioe) {
			throw new ResourceException("can not open file reader", ioe);
		}
		thread = new Thread(this);
		isRunning = true;
		thread.start();
	}
101653
public void start() {
    if (blockIds.length == 0) {
      throw new IllegalArgumentException("Zero-sized blockIds array");
    }

    client.sendRpc(openMessage.toByteBuffer(), new RpcResponseCallback() {
      @Override
      public void onSuccess(ByteBuffer response) {
        try {
          streamHandle = (StreamHandle) BlockTransferMessage.Decoder.fromByteBuffer(response);
          logger.trace("Successfully opened blocks {}, preparing to fetch chunks.", streamHandle);

          // Immediately request all chunks -- we expect that the total size of the request is
          // reasonable due to higher level chunking in [[ShuffleBlockFetcherIterator]].
          for (int i = 0; i < streamHandle.numChunks; i++) {
            if (downloadFileManager != null) {
              client.stream(OneForOneStreamManager.genStreamChunkId(streamHandle.streamId, i),
                new DownloadCallback(i));
            } else {
              client.fetchChunk(streamHandle.streamId, i, chunkCallback);
            }
          }
        } catch (Exception e) {
          logger.error("Failed while starting block fetches after success", e);
          failRemainingBlocks(blockIds, e);
        }
      }

      @Override
      public void onFailure(Throwable e) {
        logger.error("Failed while starting block fetches", e);
        failRemainingBlocks(blockIds, e);
      }
    });
  }
839782
public synchronized void start()
    {
        _buffer=new ByteArrayISO8859Writer(_bufferSize);
        _reopen=false;
        if (_started)
            return;
        
        if (_out==null && _filename!=null)
        {
            try
            {
                RolloverFileOutputStream rfos=
                    new RolloverFileOutputStream(_filename,_append,_retainDays);
                _out=rfos;
            }
            catch(IOException e){e.printStackTrace();}   
        }

        if (_out==null)
            _out=LogStream.STDERR_STREAM;
        
        _started=true;
    }
74097
private void downloadDomains() throws IOException {
		domainsFileLock.writeLock().lock();
		logger.trace("LOCK writelock");
		try {
			URL domainsURL = new URL( url + DOMAINS_PATH + getDomainFilename());
			File localFile = getDomainFile();

			logger.info("Downloading {} to: {}",domainsURL, localFile);
			FileDownloadUtils.downloadFile(domainsURL, localFile);
		} catch (MalformedURLException e) {
			logger.error("Malformed url: "+ url + DOMAINS_PATH + getDomainFilename(),e);
		} finally {
			logger.trace("UNLOCK writelock");
			domainsFileLock.writeLock().unlock();
		}
	}
21529
void imageLoaded() throws IOException {
    for (Future<Void> task : cachingTasks) {
      try {
        task.get();
      } catch (InterruptedException e) {
        throw new IOException("FSDirectory cache received interruption");
      } catch (ExecutionException e) {
        throw new IOException(e);
      }
    }
    
    // will not be used after startup
    this.cachingTasks = null;
    this.cachingExecutor.shutdownNow();
    this.cachingExecutor = null;
    
    // process remaining inodes
    for(INode inode : cachingTempQueue) {
      cacheNameInternal(inode);
    }
    this.cachingTempQueue = null;
    
    this.imageLoaded = true;
  }
127691
private void init() throws IOException {
        if (initialized.compareAndSet(false, true)) {
            log.debug("Init: {}", mode);
            // if the path is null, the consumer has been uninitialized
            if (path != null) {
                if (log.isDebugEnabled()) {
                    Path parent = path.getParent();
                    log.debug("Parent abs: {} dir: {}", parent.isAbsolute(), Files.isDirectory(parent));
                }
                if (IClientStream.MODE_APPEND.equals(mode)) {
                    if (Files.notExists(path)) {
                        throw new IOException("File to be appended doesnt exist, verify the record mode");
                    }
                    log.debug("Path: {}\nRead: {} write: {} size: {}", path, Files.isReadable(path), Files.isWritable(path), Files.size(path));
                    writer = new FLVWriter(path, true);
                } else if (IClientStream.MODE_RECORD.equals(mode)) {
                    try {
                        // delete existing file
                        if (Files.deleteIfExists(path)) {
                            log.debug("File deleted");
                        }
                        // ensure parent dirs exist
                        Files.createDirectories(path.getParent());
                        // create the file
                        path = Files.createFile(path);
                    } catch (IOException ioe) {
                        log.error("File creation error: {}", ioe);
                    }
                    if (!Files.isWritable(path)) {
                        throw new IOException("File is not writable");
                    }
                    log.debug("Path: {}\nRead: {} write: {}", path, Files.isReadable(path), Files.isWritable(path));
                    writer = new FLVWriter(path, false);
                } else {
                    try {
                        // delete existing file since we're not recording nor appending
                        if (Files.deleteIfExists(path)) {
                            log.debug("File deleted");
                        }
                    } catch (IOException ioe) {
                        log.error("File creation error: {}", ioe);
                    }
                }
            } else {
                log.warn("Consumer is uninitialized");
            }
            log.debug("Init - complete");
        }
    }
903403
void postStart(final DownloadRequest request, final long totalBytes) {
    downloadPoster.execute(new Runnable() {
      @Override public void run() {
        request.downloadCallback().onStart(request.downloadId(), totalBytes);
      }
    });
  }
998585
synchronized void open() throws IOException {
    if (syncer == null) {
      syncer = new SyncThread();
      syncThread = new Thread(syncer);
      syncThread.start();
    }
    if (state != State.BETWEEN_LOG_SEGMENTS)
      throw new IOException("Bad state: " + state);

    startLogSegment(getLastWrittenTxId() + 1, true);
    if (state != State.IN_SEGMENT)
      throw new IOException("Bad state: " + state);
  }
438182
public void openFile() throws IOException {

        // get the import resource
        m_folder = new File(OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(m_params.getPath()));

        // if it is a file it must be a zip-file
        if (m_folder.isFile()) {
            m_zipFile = new ZipFile(m_params.getPath());
            m_folder = null;
        }
    }
326846
public void start()
        throws Exception
    {
        _logDateCache=new DateCache(_logDateFormat,_logLocale);
        _logDateCache.setTimeZoneID(_logTimeZone);
        
        if (_filename != null)
        {
            _fileOut=new RolloverFileOutputStream(_filename,_append,_retainDays);
            _closeOut=true;
        }
        else
            _fileOut=System.err;

        _out=_fileOut;

        if (_ignorePaths!=null && _ignorePaths.length>0)
        {
            _ignorePathMap=new PathMap();
            for (int i=0;i<_ignorePaths.length;i++)
                _ignorePathMap.put(_ignorePaths[i],_ignorePaths[i]);
        }
        else
            _ignorePathMap=null;

        _writer=new OutputStreamWriter(_out);
    }
318825
private synchronized void prepareFile() throws IOException{
		outputFile = new File(getFileName());
		if(outputFile.exists()) 
			outputFile.delete();
		if(outputFile.isDirectory())
			throw new IOException("I/O Error on creating file: File is a directory!");
		outputFile.createNewFile();
		if(!outputFile.canWrite())
			throw new IOException("I/O Error on creating file: Unable to write into file!");
	}
1143156
public void start() throws IOException {
    server = ServerSocketChannel.open();
    server.configureBlocking(false);
    server.socket().setReuseAddress(true);
    server.socket().bind(new InetSocketAddress(port));

    monitor.add(server, this, SelectionKey.OP_ACCEPT);

    // Print a message when we are waiting to connect manually
    if (manualConnect) {
      System.out.println("Ready to accept connections on port " + port);
    }
  }
412064
public void downloadFile(int fileId, java.io.File target, FileSize size)
			throws IOException {
		WebResource builder = getResourceFactory()
				.getFileResource("/" + fileId);
		if (size != null) {
			builder = builder.path("/" + size.name().toLowerCase());
		}
		byte[] data = builder.get(byte[].class);
		FileUtils.writeByteArrayToFile(target, data);
	}
676731
void startFile(String src, PermissionStatus permissions,
                 String holder, String clientMachine,
                 boolean overwrite, boolean createParent, short replication, long blockSize
  ) throws IOException {
    INodeFileUnderConstruction file =
      startFileInternal(src, permissions, holder, clientMachine, overwrite, false,
      createParent, replication, blockSize);
    getEditLog().logSync(false);
    if (auditLog.isInfoEnabled()) {
      logAuditEvent(getCurrentUGI(),
        Server.getRemoteIp(),
        "create", src, null, file);
    }
  }