@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "size is too large .*") public void testToBytesTooLarge2() { new DataSize(9000, PETABYTE).toBytes(); }
public long toBytes() { double bytes = getValue(Unit.BYTE); Preconditions.checkState(bytes <= Long.MAX_VALUE, "size is too large to be represented in bytes as a long"); return (long) bytes; }
DataSize implements Comparable<DataSize> { public long toBytes() { double bytes = getValue(Unit.BYTE); Preconditions.checkState(bytes <= Long.MAX_VALUE, "size is too large to be represented in bytes as a long"); return (long) bytes; } }
DataSize implements Comparable<DataSize> { public long toBytes() { double bytes = getValue(Unit.BYTE); Preconditions.checkState(bytes <= Long.MAX_VALUE, "size is too large to be represented in bytes as a long"); return (long) bytes; } DataSize(double size, Unit unit); }
DataSize implements Comparable<DataSize> { public long toBytes() { double bytes = getValue(Unit.BYTE); Preconditions.checkState(bytes <= Long.MAX_VALUE, "size is too large to be represented in bytes as a long"); return (long) bytes; } DataSize(double size, Unit unit); static DataSize succinctBytes(long bytes); static DataSize succinctDataSize(double size, Unit unit); long toBytes(); double getValue(); Unit getUnit(); double getValue(Unit unit); long roundTo(Unit unit); DataSize convertTo(Unit unit); DataSize convertToMostSuccinctDataSize(); @JsonValue @Override String toString(); @JsonCreator static DataSize valueOf(String size); @Override int compareTo(DataSize o); @Override boolean equals(Object o); @Override int hashCode(); }
DataSize implements Comparable<DataSize> { public long toBytes() { double bytes = getValue(Unit.BYTE); Preconditions.checkState(bytes <= Long.MAX_VALUE, "size is too large to be represented in bytes as a long"); return (long) bytes; } DataSize(double size, Unit unit); static DataSize succinctBytes(long bytes); static DataSize succinctDataSize(double size, Unit unit); long toBytes(); double getValue(); Unit getUnit(); double getValue(Unit unit); long roundTo(Unit unit); DataSize convertTo(Unit unit); DataSize convertToMostSuccinctDataSize(); @JsonValue @Override String toString(); @JsonCreator static DataSize valueOf(String size); @Override int compareTo(DataSize o); @Override boolean equals(Object o); @Override int hashCode();  }