Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch.epfl.gameboj.component.memory;
- import java.util.Arrays;
- public final class Rom {
- private final byte[] copy;
- public Rom(byte[] data) throws NullPointerException {
- if ((data.length == 0)||(data.equals(null))) {
- throw new NullPointerException();
- }
- copy = Arrays.copyOf(data, data.length);
- }
- public final int size() {
- return copy.length;
- }
- public final int read(int index) throws IndexOutOfBoundsException {
- return Byte.toUnsignedInt(copy[java.util.Objects.checkIndex(index,copy.length)]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement