public final class SignednessUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static @Unsigned byte |
byteFromDouble(double d)
Returns an unsigned byte representing the same value as the double.
|
static @Unsigned byte |
byteFromFloat(float f)
Returns an unsigned byte representing the same value as the float.
|
static int |
compareUnsigned(@Unsigned byte x,
@Unsigned byte y)
Compares two unsigned bytes x and y.
|
static int |
compareUnsigned(@Unsigned int x,
@Unsigned int y)
Compares two unsigned ints x and y.
|
static int |
compareUnsigned(@Unsigned long x,
@Unsigned long y)
Compares two unsigned longs x and y.
|
static int |
compareUnsigned(@Unsigned short x,
@Unsigned short y)
Compares two unsigned shorts x and y.
|
static @Unsigned int |
dimensionUnsignedHeight(java.awt.Dimension dim)
Gets the unsigned int height of a Java Dimension.
|
static @Unsigned int |
dimensionUnsignedWidth(java.awt.Dimension dim)
Gets the unsigned int width of a Java Dimension.
|
static @Unsigned byte |
getUnsigned(java.nio.ByteBuffer b)
Gets an unsigned byte from the ByteBuffer b.
|
static void |
getUnsigned(java.nio.ByteBuffer b,
@Unsigned byte[] bs)
Gets an array of unsigned bytes from the ByteBuffer b and stores them in the array bs.
|
static java.nio.ByteBuffer |
getUnsigned(java.nio.ByteBuffer b,
byte[] bs,
int i,
int l)
Populates an unsigned byte array from the ByteBuffer b at i with l bytes.
|
static @Unsigned byte |
getUnsigned(java.nio.ByteBuffer b,
int i)
Gets an unsigned byte from the ByteBuffer b at i.
|
static @Unsigned int |
getUnsigned(java.nio.IntBuffer b,
int i)
Gets an unsigned int from the IntBuffer b at i.
|
static @Unsigned int |
getUnsignedInt(java.nio.ByteBuffer b)
Gets an unsigned int from the ByteBuffer b.
|
static @Unsigned int[] |
getUnsignedRGB(java.awt.image.BufferedImage b,
int startX,
int startY,
int w,
int h,
@Unsigned int[] rgbArray,
int offset,
int scansize)
Gets rgb of BufferedImage b as unsigned ints.
|
static @Unsigned short |
getUnsignedShort(java.nio.ByteBuffer b)
Gets an unsigned short from the ByteBuffer b.
|
static @Unsigned int |
intFromDouble(double d)
Returns an unsigned int representing the same value as the double.
|
static @Unsigned int |
intFromFloat(float f)
Returns an unsigned int representing the same value as the float.
|
static @Unsigned long |
longFromDouble(double d)
Returns an unsigned long representing the same value as the double.
|
static @Unsigned long |
longFromFloat(float f)
Returns an unsigned long representing the same value as the float.
|
static java.nio.ByteBuffer |
putUnsigned(java.nio.ByteBuffer b,
@Unsigned byte ubyte)
Places an unsigned byte into the ByteBuffer b.
|
static java.nio.ByteBuffer |
putUnsigned(java.nio.ByteBuffer b,
int i,
@Unsigned byte ubyte)
Places an unsigned byte into the ByteBuffer b at i.
|
static java.nio.IntBuffer |
putUnsigned(java.nio.IntBuffer b,
@Unsigned int uint)
Places an unsigned int into the IntBuffer b.
|
static java.nio.IntBuffer |
putUnsigned(java.nio.IntBuffer b,
@Unsigned int[] uints)
Places an unsigned int array into the IntBuffer b.
|
static java.nio.IntBuffer |
putUnsigned(java.nio.IntBuffer b,
@Unsigned int[] uints,
int i,
int l)
Places an unsigned int array into the IntBuffer b at i with length l.
|
static java.nio.IntBuffer |
putUnsigned(java.nio.IntBuffer b,
int i,
@Unsigned int uint)
Places an unsigned int into the IntBuffer b at i.
|
static java.nio.ByteBuffer |
putUnsignedInt(java.nio.ByteBuffer b,
@Unsigned int uint)
Places an unsigned int into the ByteBuffer b.
|
static java.nio.ByteBuffer |
putUnsignedInt(java.nio.ByteBuffer b,
int i,
@Unsigned int uint)
Places an unsigned int into the ByteBuffer b at i.
|
static java.nio.ByteBuffer |
putUnsignedLong(java.nio.ByteBuffer b,
int i,
@Unsigned long ulong)
Places an unsigned long into the ByteBuffer b at i.
|
static java.nio.ByteBuffer |
putUnsignedShort(java.nio.ByteBuffer b,
int i,
@Unsigned short ushort)
Places an unsigned short into the ByteBuffer b at i.
|
static java.nio.ByteBuffer |
putUnsignedShort(java.nio.ByteBuffer b,
@Unsigned short ushort)
Places an unsigned short into the ByteBuffer b.
|
static void |
readFullyUnsigned(java.io.RandomAccessFile f,
@Unsigned byte[] b)
Reads a file fully into an unsigned byte array.
|
static int |
readUnsigned(java.io.RandomAccessFile f,
@Unsigned byte[] b,
int off,
int len)
Reads up to
len bytes of data from this file into an unsigned array of bytes. |
static @Unsigned byte |
readUnsignedByte(java.io.RandomAccessFile f)
Reads an unsigned byte from the RandomAccessFile f.
|
static @Unsigned char |
readUnsignedChar(java.io.RandomAccessFile f)
Reads an unsigned char from the RandomAccessFile f.
|
static @Unsigned int |
readUnsignedInt(java.io.RandomAccessFile f)
Reads an unsigned int from the RandomAccessFile f.
|
static @Unsigned long |
readUnsignedLong(java.io.RandomAccessFile f)
Reads an unsigned long from the RandomAccessFile f.
|
static @Unsigned short |
readUnsignedShort(java.io.RandomAccessFile f)
Reads an unsigned short from the RandomAccessFile f.
|
static void |
setUnsignedRGB(java.awt.image.BufferedImage b,
int startX,
int startY,
int w,
int h,
@Unsigned int[] rgbArray,
int offset,
int scansize)
Sets rgb of BufferedImage b given unsigned ints.
|
static @Unsigned short |
shortFromDouble(double d)
Returns an unsigned short representing the same value as the double.
|
static @Unsigned short |
shortFromFloat(float f)
Returns an unsigned short representing the same value as the float.
|
static double |
toDouble(@Unsigned byte b)
Returns a double representing the same value as the unsigned byte.
|
static double |
toDouble(@Unsigned int i)
Returns a double representing the same value as the unsigned int.
|
static double |
toDouble(@Unsigned long l)
Returns a double representing the same value as the unsigned long.
|
static double |
toDouble(@Unsigned short s)
Returns a double representing the same value as the unsigned short.
|
static float |
toFloat(@Unsigned byte b)
Returns a float representing the same value as the unsigned byte.
|
static float |
toFloat(@Unsigned int i)
Returns a float representing the same value as the unsigned int.
|
static float |
toFloat(@Unsigned long l)
Returns a float representing the same value as the unsigned long.
|
static float |
toFloat(@Unsigned short s)
Returns a float representing the same value as the unsigned short.
|
static @Unsigned int |
toUnsignedInt(@Unsigned byte b)
Returns an unsigned int representing the same value as an unsigned byte.
|
static @Unsigned int |
toUnsignedInt(@Unsigned char c)
Returns an unsigned int representing the same value as an unsigned char.
|
static @Unsigned int |
toUnsignedInt(@Unsigned short s)
Returns an unsigned int representing the same value as an unsigned short.
|
static @Unsigned long |
toUnsignedLong(@Unsigned byte b)
Returns an unsigned long representing the same value as an unsigned byte.
|
static @Unsigned long |
toUnsignedLong(@Unsigned char c)
Returns an unsigned long representing the same value as an unsigned char.
|
static @Unsigned long |
toUnsignedLong(@Unsigned int i)
Returns an unsigned long representing the same value as an unsigned int.
|
static @Unsigned long |
toUnsignedLong(@Unsigned short s)
Returns an unsigned long representing the same value as an unsigned short.
|
static @Unsigned short |
toUnsignedShort(@Unsigned byte b)
Returns an unsigned short representing the same value as an unsigned byte.
|
static @Unsigned short |
toUnsignedShort(@Unsigned char c)
Returns an unsigned short representing the same value as an unsigned char.
|
static java.lang.String |
toUnsignedString(@Unsigned byte b)
Produces a string representation of the unsigned byte b.
|
static java.lang.String |
toUnsignedString(@Unsigned byte b,
int radix)
Produces a string representation of the unsigned byte b in base radix.
|
static java.lang.String |
toUnsignedString(@Unsigned int i)
Produces a string representation of the unsigned int i.
|
static java.lang.String |
toUnsignedString(@Unsigned int i,
int radix)
Produces a string representation of the unsigned int i in base radix.
|
static java.lang.String |
toUnsignedString(@Unsigned long l)
Produces a string representation of the unsigned long l.
|
static java.lang.String |
toUnsignedString(@Unsigned long l,
int radix)
Produces a string representation of the unsigned long l in base radix.
|
static java.lang.String |
toUnsignedString(@Unsigned short s)
Produces a string representation of the unsigned short s.
|
static java.lang.String |
toUnsignedString(@Unsigned short s,
int radix)
Produces a string representation of the unsigned short s in base radix.
|
static java.nio.ByteBuffer |
wrapUnsigned(@Unsigned byte[] array)
Wraps an unsigned byte array into a ByteBuffer.
|
static java.nio.ByteBuffer |
wrapUnsigned(@Unsigned byte[] array,
int offset,
int length)
Wraps an unsigned byte array into a ByteBuffer.
|
static void |
writeUnsigned(java.io.RandomAccessFile f,
@Unsigned byte[] bs,
int off,
int len)
Writes len unsigned bytes to the RandomAccessFile f at offset off.
|
static void |
writeUnsignedByte(java.io.RandomAccessFile f,
@Unsigned byte b)
Writes an unsigned byte to the RandomAccessFile f.
|
static void |
writeUnsignedChar(java.io.RandomAccessFile f,
@Unsigned char c)
Writes an unsigned char to the RandomAccessFile f.
|
static void |
writeUnsignedInt(java.io.RandomAccessFile f,
@Unsigned int i)
Writes an unsigned byte to the RandomAccessFile f.
|
static void |
writeUnsignedLong(java.io.RandomAccessFile f,
@Unsigned long l)
Writes an unsigned byte to the RandomAccessFile f.
|
static void |
writeUnsignedShort(java.io.RandomAccessFile f,
@Unsigned short s)
Writes an unsigned short to the RandomAccessFile f.
|
public static @Unsigned int dimensionUnsignedWidth(java.awt.Dimension dim)
public static @Unsigned int dimensionUnsignedHeight(java.awt.Dimension dim)
public static java.nio.ByteBuffer wrapUnsigned(@Unsigned byte[] array)
wrap(byte[])
, but assumes that the input should be
interpreted as unsigned.public static java.nio.ByteBuffer wrapUnsigned(@Unsigned byte[] array, int offset, int length)
wrap(byte[], int, int)
, but assumes that the
input should be interpreted as unsigned.public static @Unsigned int getUnsignedInt(java.nio.ByteBuffer b)
getInt()
, but assumes that the result should be interpreted as
unsigned.public static @Unsigned short getUnsignedShort(java.nio.ByteBuffer b)
getShort()
, but assumes that the result should be interpreted
as unsigned.public static @Unsigned byte getUnsigned(java.nio.ByteBuffer b)
get()
, but assumes that the result should be interpreted as
unsigned.public static @Unsigned byte getUnsigned(java.nio.ByteBuffer b, int i)
get(int)
, but assumes that the result should be interpreted as
unsigned.public static java.nio.ByteBuffer getUnsigned(java.nio.ByteBuffer b, byte[] bs, int i, int l)
get(byte[], int, int)
,
but assumes that the bytes should be interpreted as unsigned.public static java.nio.ByteBuffer putUnsigned(java.nio.ByteBuffer b, @Unsigned byte ubyte)
put(byte)
, but assumes that the input should be interpreted as
unsigned.public static java.nio.ByteBuffer putUnsigned(java.nio.ByteBuffer b, int i, @Unsigned byte ubyte)
put(int, byte)
, but assumes that the input should be
interpreted as unsigned.public static java.nio.IntBuffer putUnsigned(java.nio.IntBuffer b, @Unsigned int uint)
put(int)
, but assumes that the input should be interpreted as
unsigned.public static java.nio.IntBuffer putUnsigned(java.nio.IntBuffer b, int i, @Unsigned int uint)
put(int, int)
, but assumes that the input should be
interpreted as unsigned.public static java.nio.IntBuffer putUnsigned(java.nio.IntBuffer b, @Unsigned int[] uints)
put(int[])
, but assumes that the input should be interpreted
as unsigned.public static java.nio.IntBuffer putUnsigned(java.nio.IntBuffer b, @Unsigned int[] uints, int i, int l)
put(int[], int, int)
, but
assumes that the input should be interpreted as unsigned.public static @Unsigned int getUnsigned(java.nio.IntBuffer b, int i)
get(int)
, but assumes that the output should be interpreted as
unsigned.public static java.nio.ByteBuffer putUnsignedShort(java.nio.ByteBuffer b, @Unsigned short ushort)
putShort(short)
, but assumes that the input should be
interpreted as unsigned.public static java.nio.ByteBuffer putUnsignedShort(java.nio.ByteBuffer b, int i, @Unsigned short ushort)
putShort(int, short)
, but assumes that the input
should be interpreted as unsigned.public static java.nio.ByteBuffer putUnsignedInt(java.nio.ByteBuffer b, @Unsigned int uint)
putInt(int)
, but assumes that the input should be
interpreted as unsigned.public static java.nio.ByteBuffer putUnsignedInt(java.nio.ByteBuffer b, int i, @Unsigned int uint)
putInt(int, int)
, but assumes that the input should be
interpreted as unsigned.public static java.nio.ByteBuffer putUnsignedLong(java.nio.ByteBuffer b, int i, @Unsigned long ulong)
putLong(int, long)
, but assumes that the input should
be interpreted as unsigned.public static void setUnsignedRGB(java.awt.image.BufferedImage b, int startX, int startY, int w, int h, @Unsigned int[] rgbArray, int offset, int scansize)
setRGB(int, int,
int, int, int[], int, int)
, but assumes that the input should be interpreted as unsigned.public static @Unsigned int[] getUnsignedRGB(java.awt.image.BufferedImage b, int startX, int startY, int w, int h, @Unsigned int[] rgbArray, int offset, int scansize)
getRGB(int, int,
int, int, int[], int, int)
, but assumes that the output should be interpreted as unsigned.public static @Unsigned byte readUnsignedByte(java.io.RandomAccessFile f) throws java.io.IOException
readByte()
, but assumes the output should be interpreted
as unsigned.java.io.IOException
public static @Unsigned char readUnsignedChar(java.io.RandomAccessFile f) throws java.io.IOException
readChar()
, but assumes the output should be interpreted
as unsigned.java.io.IOException
public static @Unsigned short readUnsignedShort(java.io.RandomAccessFile f) throws java.io.IOException
readShort()
, but assumes the output should be
interpreted as unsigned.java.io.IOException
public static @Unsigned int readUnsignedInt(java.io.RandomAccessFile f) throws java.io.IOException
readInt()
, but assumes the output should be interpreted
as unsigned.java.io.IOException
public static @Unsigned long readUnsignedLong(java.io.RandomAccessFile f) throws java.io.IOException
readLong()
, but assumes the output should be interpreted
as unsigned.java.io.IOException
public static int readUnsigned(java.io.RandomAccessFile f, @Unsigned byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from this file into an unsigned array of bytes. This
method is a wrapper around read(byte[], int, int)
, but assumes the output should be interpreted as unsigned.java.io.IOException
public static void readFullyUnsigned(java.io.RandomAccessFile f, @Unsigned byte[] b) throws java.io.IOException
readFully(byte[])
, but assumes the output should
be interpreted as unsigned.java.io.IOException
public static void writeUnsigned(java.io.RandomAccessFile f, @Unsigned byte[] bs, int off, int len) throws java.io.IOException
write(byte[], int, int)
, but
assumes the input should be interpreted as unsigned.java.io.IOException
public static void writeUnsignedByte(java.io.RandomAccessFile f, @Unsigned byte b) throws java.io.IOException
writeByte(int)
, but assumes the input should be
interpreted as unsigned.java.io.IOException
public static void writeUnsignedChar(java.io.RandomAccessFile f, @Unsigned char c) throws java.io.IOException
writeChar(int)
, but assumes the input should be
interpreted as unsigned.java.io.IOException
public static void writeUnsignedShort(java.io.RandomAccessFile f, @Unsigned short s) throws java.io.IOException
writeShort(int)
, but assumes the input should be
interpreted as unsigned.java.io.IOException
public static void writeUnsignedInt(java.io.RandomAccessFile f, @Unsigned int i) throws java.io.IOException
writeInt(int)
, but assumes the input should be
interpreted as unsigned.java.io.IOException
public static void writeUnsignedLong(java.io.RandomAccessFile f, @Unsigned long l) throws java.io.IOException
writeLong(long)
, but assumes the input should be
interpreted as unsigned.java.io.IOException
public static void getUnsigned(java.nio.ByteBuffer b, @Unsigned byte[] bs)
get(byte[])
, but assumes
that the array of bytes should be interpreted as unsigned.public static int compareUnsigned(@Unsigned long x, @Unsigned long y)
This is a reimplementation of Java 8's Long.compareUnsigned(long, long)
.
public static int compareUnsigned(@Unsigned int x, @Unsigned int y)
This is a reimplementation of Java 8's Integer.compareUnsigned(int, int)
.
public static int compareUnsigned(@Unsigned short x, @Unsigned short y)
public static int compareUnsigned(@Unsigned byte x, @Unsigned byte y)
public static java.lang.String toUnsignedString(@Unsigned long l)
This is a reimplementation of Java 8's Long.toUnsignedString(long)
.
public static java.lang.String toUnsignedString(@Unsigned long l, int radix)
This is a reimplementation of Java 8's Long.toUnsignedString(long, int)
.
public static java.lang.String toUnsignedString(@Unsigned int i)
This is a reimplementation of Java 8's Integer.toUnsignedString(int)
.
public static java.lang.String toUnsignedString(@Unsigned int i, int radix)
This is a reimplementation of Java 8's Integer.toUnsignedString(int, int)
.
public static java.lang.String toUnsignedString(@Unsigned short s)
public static java.lang.String toUnsignedString(@Unsigned short s, int radix)
public static java.lang.String toUnsignedString(@Unsigned byte b)
public static java.lang.String toUnsignedString(@Unsigned byte b, int radix)
public static @Unsigned long toUnsignedLong(@Unsigned int i)
This is a reimplementation of Java 8's Integer.toUnsignedLong(int)
.
public static @Unsigned long toUnsignedLong(@Unsigned short s)
public static @Unsigned int toUnsignedInt(@Unsigned short s)
public static @Unsigned long toUnsignedLong(@Unsigned byte b)
public static @Unsigned int toUnsignedInt(@Unsigned byte b)
public static @Unsigned short toUnsignedShort(@Unsigned byte b)
public static @Unsigned long toUnsignedLong(@Unsigned char c)
public static @Unsigned int toUnsignedInt(@Unsigned char c)
public static @Unsigned short toUnsignedShort(@Unsigned char c)
public static float toFloat(@Unsigned byte b)
public static float toFloat(@Unsigned short s)
public static float toFloat(@Unsigned int i)
public static float toFloat(@Unsigned long l)
public static double toDouble(@Unsigned byte b)
public static double toDouble(@Unsigned short s)
public static double toDouble(@Unsigned int i)
public static double toDouble(@Unsigned long l)
public static @Unsigned byte byteFromFloat(float f)
public static @Unsigned short shortFromFloat(float f)
public static @Unsigned int intFromFloat(float f)
public static @Unsigned long longFromFloat(float f)
public static @Unsigned byte byteFromDouble(double d)
public static @Unsigned short shortFromDouble(double d)
public static @Unsigned int intFromDouble(double d)
public static @Unsigned long longFromDouble(double d)