Skip to content

Commit

Permalink
ZipEightByteInteger.toString() now returns a number string without text
Browse files Browse the repository at this point in the history
prefix, like BigInteger
  • Loading branch information
garydgregory committed Nov 26, 2024
1 parent 480f2a5 commit 46f7bd8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory, Arturo Bernal">CompressorException extends IOException #605, see also https://github.com/apache/httpcomponents-client/pull/580.</action>
<action type="fix" dev="ggregory" due-to="Glavo">Update outdated descriptions in IOUtils and IOUtilsTest #612.</action>
<action type="fix" dev="ggregory" due-to="Glavo">Remove unused local variable in ZipFile #615.</action>
<action type="fix" dev="ggregory" due-to="Glavo, Gary Gregory">Optimize ZipEightByteInteger #614.</action>
<action type="fix" dev="ggregory" due-to="Glavo, Gary Gregory">Optimize ZipEightByteInteger #614.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">ZipEightByteInteger.toString() now returns a number string without text prefix, like BigInteger.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.getModificationInstant().</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.setModificationInstant(Instant).</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public final class ZipEightByteInteger implements Serializable {

private static final int BYTES = 8;
static final int BYTES = 8;

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -204,6 +204,6 @@ public int hashCode() {

@Override
public String toString() {
return "ZipEightByteInteger value: " + Long.toUnsignedString(value);
return Long.toUnsignedString(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ public void testSign() {
*/
@Test
public void testToString() {
assertEquals("ZipEightByteInteger value: 18446744073709551615", newMaxValue().toString());
assertEquals("0", ZipEightByteInteger.ZERO.toString());
assertEquals("0", ZipEightByteInteger.getValue(new byte[ZipEightByteInteger.BYTES]).toString());
assertEquals(Long.toString(Long.MAX_VALUE), new ZipEightByteInteger(BigInteger.valueOf(Long.MAX_VALUE)).toString());
assertEquals("18446744073709551615", newMaxValue().toString());
}

/**
Expand Down

0 comments on commit 46f7bd8

Please sign in to comment.