Skip to content

Commit 8d80942

Browse files
committed
update Java version
1 parent 7a821c9 commit 8d80942

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

src/main/java/com/upokecenter/cbor/CBORObject.java

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,13 @@ public static void AddTagHandler(BigInteger bigintTag, ICBORTag handler) {
629629
}
630630

631631
/**
632-
*
632+
* Registers an object that validates CBOR objects with new tags.
633+
* @param bigintTag An arbitrary-precision integer.
634+
* @param handler An ICBORTag object.
635+
* @throws java.lang.NullPointerException The parameter {@code bigintTag} or
636+
* {@code handler} is null.
637+
* @throws java.lang.NullPointerException The parameter {@code bigintTag} is less
638+
* than 0 or greater than (2^64-1).
633639
*/
634640
static void AddTagHandler(EInteger bigintTag, ICBORTag handler) {
635641
if (bigintTag == null) {
@@ -846,7 +852,10 @@ public static CBORObject FromObject(ExtendedFloat bigValue) {
846852
}
847853

848854
/**
849-
*
855+
* Generates a CBOR object from an arbitrary-precision binary floating-point
856+
* number.
857+
* @param bigValue An arbitrary-precision binary floating-point number.
858+
* @return A CBOR number.
850859
*/
851860
static CBORObject FromObject(EFloat bigValue) {
852861
if ((Object)bigValue == (Object)null) {
@@ -869,7 +878,10 @@ static CBORObject FromObject(EFloat bigValue) {
869878
}
870879

871880
/**
872-
*
881+
* Generates a CBOR object from an arbitrary-precision binary floating-point
882+
* number.
883+
* @param bigValue An arbitrary-precision binary floating-point number.
884+
* @return A CBOR number.
873885
*/
874886
public static CBORObject FromObject(ExtendedRational bigValue) {
875887
return ((Object)bigValue == (Object)null) ? (CBORObject.Null) :
@@ -1670,7 +1682,19 @@ public static void Write(ExtendedFloat bignum, OutputStream stream) throws java.
16701682
}
16711683

16721684
/**
1673-
*
1685+
* Writes a binary floating-point number in CBOR format to a data stream as
1686+
* follows: <ul> <li>If the value is null, writes the byte 0xF6.</li>
1687+
* <li>If the value is negative zero, infinity, or NaN, converts the
1688+
* number to a <code>double</code> and writes that <code>double</code>. If negative
1689+
* zero should not be written this way, use the Plus method to convert
1690+
* the value beforehand.</li> <li>If the value has an exponent of zero,
1691+
* writes the value as an unsigned integer or signed integer if the
1692+
* number can fit either type or as a big integer otherwise.</li> <li>In
1693+
* all other cases, writes the value as a big float.</li></ul>
1694+
* @param bignum An arbitrary-precision binary float.
1695+
* @param stream A writable data stream.
1696+
* @throws java.lang.NullPointerException The parameter {@code stream} is null.
1697+
* @throws java.io.IOException An I/O error occurred.
16741698
*/
16751699
static void Write(EFloat bignum, OutputStream stream) throws java.io.IOException {
16761700
if (stream == null) {
@@ -1722,7 +1746,11 @@ public static void Write(ExtendedRational rational, OutputStream stream) throws
17221746
}
17231747

17241748
/**
1725-
*
1749+
* Writes a rational number in CBOR format to a data stream.
1750+
* @param rational An arbitrary-precision rational number.
1751+
* @param stream A writable data stream.
1752+
* @throws java.lang.NullPointerException The parameter {@code stream} is null.
1753+
* @throws java.io.IOException An I/O error occurred.
17261754
*/
17271755
static void Write(ERational rational, OutputStream stream) throws java.io.IOException {
17281756
if (stream == null) {
@@ -1774,7 +1802,19 @@ public static void Write(ExtendedDecimal bignum, OutputStream stream) throws jav
17741802
}
17751803

17761804
/**
1777-
*
1805+
* Writes a decimal floating-point number in CBOR format to a data stream, as
1806+
* follows: <ul> <li>If the value is null, writes the byte 0xF6.</li>
1807+
* <li>If the value is negative zero, infinity, or NaN, converts the
1808+
* number to a <code>double</code> and writes that <code>double</code>. If negative
1809+
* zero should not be written this way, use the Plus method to convert
1810+
* the value beforehand.</li> <li>If the value has an exponent of zero,
1811+
* writes the value as an unsigned integer or signed integer if the
1812+
* number can fit either type or as a big integer otherwise.</li> <li>In
1813+
* all other cases, writes the value as a decimal number.</li></ul>
1814+
* @param bignum The arbitrary-precision decimal number to write. Can be null.
1815+
* @param stream InputStream to write to.
1816+
* @throws java.lang.NullPointerException The parameter {@code stream} is null.
1817+
* @throws java.io.IOException An I/O error occurred.
17781818
*/
17791819
static void Write(EDecimal bignum, OutputStream stream) throws java.io.IOException {
17801820
if (stream == null) {
@@ -1826,7 +1866,11 @@ public static void Write(BigInteger bigint, OutputStream stream) throws java.io.
18261866
}
18271867

18281868
/**
1829-
*
1869+
* Writes a big integer in CBOR format to a data stream.
1870+
* @param bigint Big integer to write. Can be null.
1871+
* @param stream A writable data stream.
1872+
* @throws java.lang.NullPointerException The parameter {@code stream} is null.
1873+
* @throws java.io.IOException An I/O error occurred.
18301874
*/
18311875
static void Write(EInteger bigint, OutputStream stream) throws java.io.IOException {
18321876
if (stream == null) {

src/main/java/com/upokecenter/util/TrapException.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
import com.upokecenter.numbers.*;
1111

1212
/**
13-
* Exception thrown for arithmetic trap errors.
13+
* <p><b>This class is obsolete. It will be replaced by a new version of this
14+
* class in a different namespace/package and library, called
15+
* <code>PeterO.Numbers.ETrapException</code> in the <code>PeterO.Numbers</code>
16+
* library (in .NET), or <code>com.upokecenter.numbers.getETrapException()</code>
17+
* in the <code>com.github.peteroupc/numbers</code> artifact (in
18+
* Java).</b></p> Exception thrown for arithmetic trap errors.
1419
* @deprecated Use ETrapException from PeterO.Numbers/com.upokecenter.numbers.
1520
*/
1621
@Deprecated

0 commit comments

Comments
 (0)