{@inheritDoc}

This method would block as necessary if running out of disk space.
195791
@Override
    public void write(byte[] b, int off, int len) throws IOException {
        if (b.length == 0)
            return;
        fos().write(b, off, len);
        currFileBytesWritten += len;
        totalBytesWritten += len;
    }
595202
public void syncInMemorySize() throws IOException {
    if (finalizedSize == UNFINALIZED) {
      throw new IOException("Block is not finalized");
    }
    if (!inlineChecksum) {
      this.finalizedSize = blockDataFile.getFile().length();
    } else {
      this.finalizedSize = BlockInlineChecksumReader
          .getBlockSizeFromFileLength(blockDataFile.getFile().length(),
              checksumType, bytesPerChecksum);
    }
  }
615828
function () {
    const oThis = this
    ;

    oThis.snmData.lastProcessedBlock = oThis.toBlock;

    fs.writeFileSync(
      oThis.filePath,
      JSON.stringify(oThis.snmData),
      function (err) {
        if (err)
          logger.error(err);
      }
    );

    if (oThis.interruptSignalObtained) {
      logger.info('Exiting Process....');
      process.exit(1);
    }
  }
186050
private boolean discardDone(INodeFileUnderConstruction pendingFile,
                              String src) throws IOException {
    Block[] blocks = pendingFile.getBlocks();
    if (blocks == null || blocks.length == 0) {
      return false;
    }
    Block last = blocks[blocks.length-1];
    if (last.getNumBytes() == 0) {
      dir.removeBlock(src, pendingFile, last);
      finalizeINodeFileUnderConstruction(src, pendingFile);
      NameNode.stateChangeLog.warn("BLOCK*" +
          " internalReleaseLease: discarded last block " + last +
          " , lease removed for " +  src);
      return true;
    }
    return false;
  }
1028588
public void ensureSpareCapacity(int n)
        throws IOException
    {
        // Do we have space?
        if (n>spareCapacity())
        {
            // No, then try flushing what we do have
            if (_pos>_start )
                flush();

            ensureCapacity(n);
        }
    }
137876
private void stop() {
		for (int i = 0; i < mDownloadDispatchers.length; i++) {
			if (mDownloadDispatchers[i] != null) {
				mDownloadDispatchers[i].quit();
			}
		}
	}
1313958
private static function stopStorage(ServerRequestInterface $request)
    {
        $storage = self::getAttribute($request, Middleware::STORAGE_KEY);
        self::setAttribute($request, Middleware::STORAGE_KEY, null);

        return (array) $storage;
    }
82850
public void truncate() throws IOException {
    getDatabase().checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_UPDATE);

    getDatabase().getStorage().callInLock(new Callable<Object>() {
      public Object call() throws Exception {
        for (int id : clusterIds) {
          getDatabase().getStorage().getClusterById(id).truncate();
        }

        for (OIndex<?> index : getClassIndexes()) {
          index.clear();
        }
        return null;
      }
    }, true);
  }
1235523
public void stop()
    {
        try{if (_writer!=null)_writer.flush();} catch (IOException e){LogSupport.ignore(log,e);}
        if (_out!=null && _closeOut)
            try{_out.close();}catch(IOException e){LogSupport.ignore(log,e);}
        _out=null;
        _fileOut=null;
        _closeOut=false;
        _logDateCache=null;
        _writer=null;
    }
1026824
@Override
	public void stopped() {

		// Stop timer
		if (timer != null) {
			timer.cancel(false);
			timer = null;
		}

		// Clear partitions
		final long stamp = lock.writeLock();
		try {
			partitions.clear();
		} finally {
			lock.unlockWrite(stamp);
		}
	}
864161
void discardUnusedTail()
    {
        // we guard this with the OpOrdering instead of synchronised due to potential dead-lock with CLSM.advanceAllocatingFrom()
        // this actually isn't strictly necessary, as currently all calls to discardUnusedTail occur within a block
        // already protected by this OpOrdering, but to prevent future potential mistakes, we duplicate the protection here
        // so that the contract between discardUnusedTail() and sync() is more explicit.
        try (OpOrder.Group group = appendOrder.start())
        {
            while (true)
            {
                int prev = allocatePosition.get();
                // we set allocatePosition past buffer.capacity() to make sure we always set discardedTailFrom
                int next = buffer.capacity() + 1;
                if (prev == next)
                    return;
                if (allocatePosition.compareAndSet(prev, next))
                {
                    discardedTailFrom = prev;
                    return;
                }
            }
        }
    }
1154955
@Override
  public void clear() {
    try {
      file.setLength(header.size());
    }
    catch(IOException e) {
      throw new RuntimeException(e);
    }
  }
1339610
protected void checkDiskError(Exception e ) throws IOException {
    if (e instanceof ClosedByInterruptException
        || e instanceof java.io.InterruptedIOException) {
      return;
    }
    LOG.warn("checkDiskError: exception: ", e);
    
    if (e.getMessage() != null &&
        e.getMessage().startsWith("No space left on device")) {
      throw new DiskOutOfSpaceException("No space left on device");
    } else {
      checkDiskError();
    }
  }
1353384
public void setMinFreeDiskSpace(String value) {
		if (value == null) {
			LogLog.warn("Null min free disk space supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getMinFreeDiscSpace());
			return;
		}
		value = value.trim();
		if ("".equals(value)) {
			LogLog.warn("Empty min free disk space supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getMinFreeDiscSpace());
			return;
		}
		final long defaultMinFreeDiskSpace = this.getProperties().getMinFreeDiscSpace();
		final long minFreeDiskSpace = OptionConverter.toFileSize(value, defaultMinFreeDiskSpace);
		this.getProperties().setMinFreeDiscSpace(minFreeDiskSpace);
	}
1056813
private void ensureCapacity() {
    if (size < resourceIds.length) {
      return;
    }
    int newCapacity = (resourceIds.length * 3) / 2 + 1;
    // Increase size of resourceIds
    String[] oldResourceIds = resourceIds;
    resourceIds = new String[newCapacity];
    System.arraycopy(oldResourceIds, 0, resourceIds, 0, oldResourceIds.length);
    // Increase size of blockData
    int[] oldBlockData = blockData;
    blockData = new int[newCapacity * blockInts];
    System.arraycopy(oldBlockData, 0, blockData, 0, oldBlockData.length);
    // Increase size of byResourceIndices (no need to copy old, because would be restored in method ensureSorted)
    resourceIdsIndex = new int[newCapacity];
    sorted = false;
  }
481921
public void ensureSize(int bufSize, int pre, int post)
        throws IOException
    {
        // Do we have space?
        if (bufSize>_buf.length || pre>_preReserve || post>_postReserve)
        {
            // Make a bigger buffer if we are allowed.
            if (_fixed)
                throw new IllegalStateException("Fixed");

            byte[] old=_buf;
            _buf=ByteArrayPool.getByteArray(bufSize);

            if (_pos>_start)
                System.arraycopy(old,_start,_buf,pre,_pos-_start);
            if (!_resized)
                ByteArrayPool.returnByteArray(old);
            
            _end=_buf.length-post;
            _preReserve=pre;
            _start=pre;
            _pos=pre;
            _postReserve=post;
        }
    }
1331496
private void setLastBlockSize(INodeFileUnderConstruction pendingFile) {
    Block block = pendingFile.getLastBlock();
    if (block != null) {
      block.setNumBytes(pendingFile.getPreferredBlockSize());
    }
  }