{@inheritDoc}

@see java.nio.file.attribute.BasicFileAttributes#size()
546234
@Override
    public long size() {
        if (this.isDirectory()) {
            return -1L;
        }

        final Asset asset = this.getArchive().get(this.path.toString()).getAsset();
        final InputStream stream = asset.openStream();
        int totalRead = 0;
        final byte[] buffer = new byte[1024 * 4];
        int read = 0;
        try {
            while ((read = stream.read(buffer, 0, buffer.length)) != -1) {
                totalRead += read;
            }
        } catch (final IOException ioe) {
            throw new RuntimeException(ioe);
        }

        return totalRead;
    }
1341470
public function get_size()
  {
    if ( $this->file && $this->size === 0 ){
      $this->size = filesize($this->file);
    }
    return $this->size;
  }
415243
@Override
    public long size() {
        try {
            if (emulateIsAbsent)
                lock.readLock().lock();

            return compressedEntries.size();
        } finally {
            if (emulateIsAbsent)
                lock.readLock().unlock();
        }
    }
1162495
public void setFile(InputStream inputStream, String filename, long fileSize) {
        this.setFile(inputStream, filename);
        this.fileSize = fileSize;
    }
816753
private static int calculateAttributeSizeInBytes(final AttributeValue value) {
        int attrValSize = 0;
        if (value == null) {
            return attrValSize;
        }

        if (value.getB() != null) {
            final ByteBuffer b = value.getB();
            attrValSize += b.remaining();
        } else if (value.getS() != null) {
            final String s = value.getS();
            attrValSize += s.getBytes(UTF8).length;
        } else if (value.getN() != null) {
            attrValSize += MAX_NUMBER_OF_BYTES_FOR_NUMBER;
        } else if (value.getBS() != null) {
            final List<ByteBuffer> bs = value.getBS();
            for (ByteBuffer b : bs) {
                if (b != null) {
                    attrValSize += b.remaining();
                }
            }
        } else if (value.getSS() != null) {
            final List<String> ss = value.getSS();
            for (String s : ss) {
                if (s != null) {
                    attrValSize += s.getBytes(UTF8).length;
                }
            }
        } else if (value.getNS() != null) {
            final List<String> ns = value.getNS();
            for (String n : ns) {
                if (n != null) {
                    attrValSize += MAX_NUMBER_OF_BYTES_FOR_NUMBER;
                }
            }
        } else if (value.getBOOL() != null) {
            attrValSize += 1;
        } else if (value.getNULL() != null) {
            attrValSize += 1;
        } else if (value.getM() != null) {
            for (Map.Entry<String, AttributeValue> entry : value.getM().entrySet()) {
                attrValSize += entry.getKey().getBytes(UTF8).length;
                attrValSize += calculateAttributeSizeInBytes(entry.getValue());
                attrValSize += BASE_LOGICAL_SIZE_OF_NESTED_TYPES;
            }
            attrValSize += LOGICAL_SIZE_OF_EMPTY_DOCUMENT;
        } else if (value.getL() != null) {
            final List<AttributeValue> list = value.getL();
            for (Integer i = 0; i < list.size(); i++) {
                attrValSize += calculateAttributeSizeInBytes(list.get(i));
                attrValSize += BASE_LOGICAL_SIZE_OF_NESTED_TYPES;
            }
            attrValSize += LOGICAL_SIZE_OF_EMPTY_DOCUMENT;
        }
        return attrValSize;
    }
1258156
function _getSize(attribute, value) {
    hasNumeric = _hasRule(attribute, _numericRules);

    // This method will determine if the attribute is a number, string, or file and
    // return the proper size accordingly. If it is a number, then number itself
    // is the size. If it is a file, we take kilobytes, and for a string the
    // entire length of the string will be considered the attribute size.
    if (/^[0-9]+$/.test(value) && hasNumeric) {
      return getValue(attribute);
    } else if (value && is_string(value) || is_array(value)) {
      return value.length;
    }

    return 0;
  }
1302173
@Override public final int size(){
      if( _size != 0 ) return _size; // Cached size

      assert _nodeType == 0:"unexpected node type: " + _nodeType;
      if(_split._equal != 0)
        _nodeType |= _split._equal == 1 ? 4 : (_split._equal == 2 ? 8 : 12);

      // int res = 7;  // 1B node type + flags, 2B colId, 4B float split val
      // 1B node type + flags, 2B colId, 4B split val/small group or (2B offset + 4B size) + large group
      int res = _split._equal == 3 ? 9 + _split._bs.numBytes() : 7;

      // NA handling correction
      res++; //1 byte for NA split dir
      if (_split._nasplit == DHistogram.NASplitDir.NAvsREST)
        res -= _split._equal == 3 ? 6 + _split._bs.numBytes() : 4; //don't need certain stuff

      Node left = _tree.node(_nids[0]);
      int lsz = left.size();
      res += lsz;
      if( left instanceof LeafNode ) _nodeType |= (byte)48;
      else {
        int slen = lsz < 256 ? 0 : (lsz < 65535 ? 1 : (lsz<(1<<24) ? 2 : 3));
        _nodeType |= slen; // Set the size-skip bits
        res += (slen+1); //
      }

      Node right = _tree.node(_nids[1]);
      if( right instanceof LeafNode ) _nodeType |= (byte)(48 << 2);
      res += right.size();
      assert (_nodeType&0x33) != 51;
      assert res != 0;
      return (_size = res);
    }
734492
public static String formatFileSize(long size) {
        if (size < 1024)
            return size + " B";
        else if (size < 1024 * 1024)
            return new DecimalFormat("#.# KB").format((double)size / 1024);
        else if (size < 1024 * 1024 * 1024)
            return new DecimalFormat("#.# MB").format((double)size / 1024 / 1024);

        return new DecimalFormat("#.# GB").format((double)size / 1024 / 1024 / 1024);
    }
62705
public int size() {
		writeLock.lock();
		try {
			if (this.size < 0) {
				this.size = 0;
				for (LinkedHashMap<String, String> value : this.values()) {
					this.size += value.size();
				}
			}
		} finally {
			writeLock.unlock();
		}
		return this.size;
	}
490104
public void setLength(int size)
  {
    expand(size);

    for (int i = _size; i < size; i++)
      _data[i] = 0;

    _size = size;
  }
1250830
public int size() {
        int retval=0;
        for(int i=0; i < index; i++)
            if(messages[i] != null)
                retval++;
        return retval;
    }
669337
def size(self):
        ''''''
        c = self.database.cursor()
        r = c.execute("SELECT sum(size) FROM files")

        try:
            size = int(r.fetchone()[0])
        except TypeError:
            size = 0

        return size
1203436
public function size():int
    {
        if ($this->file == null) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot get size for unopened file",
                "solution" =>
                    "Please open the file with [FileListener::open] before trying to get the size.")));
        }
        return (filesize($this->filepath));
    }
132622
public int getSize() {
		if (size < 0) {
			size = logCache==null ? 0 : logCache.getSize();
			size += traceCache==null ? 0 : traceCache.getSize();
		}
		return size;
	}
1016428
static public int getByteSize() {
    int size = 0;
    size += 16;
    size += 16;
    size += 24;
    size += 24;
    size += 20;
    size += 3;
    size += 5;
    size += 36;
    size += 64;
    size += 64;
    size = size/8;
    return size;
  }
1356519
@View(name = "size", map = "function(doc) { if (doc.service) { emit(doc, doc._id) }}", reduce = "_count")
    public int size() {
        val r = db.queryView(createQuery("size"));
        LOGGER.trace("r.isEmpty [{}]", r.isEmpty());
        LOGGER.trace("r.getRows [{}]", r.getRows());
        if (r.isEmpty()) {
            return 0;
        }

        return r.getRows().get(0).getValueAsInt();
    }
254693
public static long getSize(File dir)
   {
      long size = 0;
      for (File file : dir.listFiles())
      {
         if (file.isFile())
         {
            size += file.length();
         }
         else
         {
            size += getSize(file);
         }
      }

      return size;
   }