import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Utility methods for working with {@link WritableObject}s.
* @author Robert Varga
*/
@Beta
+@NonNullByDefault
public final class WritableObjects {
private WritableObjects() {
- throw new UnsupportedOperationException();
+ // Hidden on purpose
}
/**
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
- public static long readLong(final @Nonnull DataInput in) throws IOException {
+ public static long readLong(final DataInput in) throws IOException {
return readLongBody(in, readLongHeader(in));
}
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
- public static byte readLongHeader(final @Nonnull DataInput in) throws IOException {
+ public static byte readLongHeader(final DataInput in) throws IOException {
return in.readByte();
}
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
- public static long readLongBody(final @Nonnull DataInput in, final byte header) throws IOException {
+ public static long readLongBody(final DataInput in, final byte header) throws IOException {
int bytes = header & 0xF;
if (bytes >= 8) {
return in.readLong();
* @throws IOException if an I/O error occurs
* @throws NullPointerException if output is null
*/
- public static void writeLongs(final @Nonnull DataOutput out, final long value0, final long value1)
- throws IOException {
+ public static void writeLongs(final DataOutput out, final long value0, final long value1) throws IOException {
final int clen = WritableObjects.valueBytes(value1);
writeLong(out, value0, clen << 4);
WritableObjects.writeValue(out, value1, clen);
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
- public static long readFirstLong(final @Nonnull DataInput in, final byte header) throws IOException {
+ public static long readFirstLong(final DataInput in, final byte header) throws IOException {
return WritableObjects.readLongBody(in, header);
}
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
- public static long readSecondLong(final @Nonnull DataInput in, final byte header) throws IOException {
- return WritableObjects.readLongBody(in, (byte)(header >>> 4));
+ public static long readSecondLong(final DataInput in, final byte header) throws IOException {
+ return WritableObjects.readLongBody(in, (byte)(header >> 4));
}
private static void writeValue(final DataOutput out, final long value, final int bytes) throws IOException {