From 3ee6a3c40ae549c5b6ca5d212b0d4fbcc422d8a1 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 8 Jun 2022 19:09:54 -0300 Subject: [PATCH 01/23] javax: microedition: rms: Truncate record IDs to 0 in some cases. Games like 3D Pinball Timeshock use the -1 index as a record ID for some reason, so in cases where the index is lower than 0, the code truncates the index to 0. Allowing Timeshock to boot, but failing a bit later due to the current 3D implementation. --- src/javax/microedition/rms/RecordStore.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/javax/microedition/rms/RecordStore.java b/src/javax/microedition/rms/RecordStore.java index ff9fccd2d..267fea24f 100644 --- a/src/javax/microedition/rms/RecordStore.java +++ b/src/javax/microedition/rms/RecordStore.java @@ -548,6 +548,7 @@ public int nextRecordId() throws InvalidRecordIDException //System.out.println("> Next Record ID (idx:"+index+" cnt:"+count+")"); if(keepupdated) { rebuild(); } if(index>=count) { throw(new InvalidRecordIDException()); } + if(index < 0) return elements[0]; // If an invalid index is received, truncate it to 0. return elements[index]; } From 35cb096b2c95b783347aac0e71824256b503750a Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Thu, 9 Jun 2022 03:44:28 -0300 Subject: [PATCH 02/23] freej2me-lr: Fix rotated pointer coordinates. Before, when the screen was rotated on the libretro frontend, the pointer coordinates in the java file were reversed correctly, but some extra calculations to account for the 90 degrees counterclockwise rotation were not done, making the pointer be "reversed" in the y axis, so the lower the pointer was in the screen, the higher the y value it had in the rotated mode. Now it works as intended. --- src/org/recompile/freej2me/Libretro.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/recompile/freej2me/Libretro.java b/src/org/recompile/freej2me/Libretro.java index 09dba5503..29270ca05 100644 --- a/src/org/recompile/freej2me/Libretro.java +++ b/src/org/recompile/freej2me/Libretro.java @@ -185,7 +185,7 @@ public void run() } else { - Mobile.getPlatform().pointerReleased(mousey, mousex); + Mobile.getPlatform().pointerReleased(-mousey+lcdWidth, mousex); } break; @@ -198,7 +198,7 @@ public void run() } else { - Mobile.getPlatform().pointerPressed(mousey, mousex); + Mobile.getPlatform().pointerPressed(-mousey+lcdWidth, mousex); } break; @@ -211,7 +211,7 @@ public void run() } else { - Mobile.getPlatform().pointerDragged(mousey, mousex); + Mobile.getPlatform().pointerDragged(-mousey+lcdWidth, mousex); } break; From 255da6a6d8d7c4412173b810c62fe313e7f912fe Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sat, 11 Jun 2022 15:25:40 -0300 Subject: [PATCH 03/23] javax: io: Implement the javax.microedition.io.file.* classes. Some games rely on those classes to be present, like my 320x240 copy of Asphalt Nitro. The 240x320 version of the same game doesn't seem to use them however. All files are based off of Java's ME JSR Community Process docs. --- .../io/file/ConnectionClosedException.java | 24 +++++ .../microedition/io/file/FileConnection.java | 90 +++++++++++++++++++ .../io/file/FileSystemListener.java | 26 ++++++ .../io/file/FileSystemRegistry.java | 28 ++++++ .../io/file/IllegalModeException.java | 24 +++++ 5 files changed, 192 insertions(+) create mode 100644 src/javax/microedition/io/file/ConnectionClosedException.java create mode 100644 src/javax/microedition/io/file/FileConnection.java create mode 100644 src/javax/microedition/io/file/FileSystemListener.java create mode 100644 src/javax/microedition/io/file/FileSystemRegistry.java create mode 100644 src/javax/microedition/io/file/IllegalModeException.java diff --git a/src/javax/microedition/io/file/ConnectionClosedException.java b/src/javax/microedition/io/file/ConnectionClosedException.java new file mode 100644 index 000000000..02acd718e --- /dev/null +++ b/src/javax/microedition/io/file/ConnectionClosedException.java @@ -0,0 +1,24 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.microedition.io.file; + +public class ConnectionClosedException extends RuntimeException +{ + public ConnectionClosedException() {} + + public ConnectionClosedException(String detailMessage) { System.out.println("ConnectionClosedException: " + detailMessage); } +} diff --git a/src/javax/microedition/io/file/FileConnection.java b/src/javax/microedition/io/file/FileConnection.java new file mode 100644 index 000000000..9eed4ed5c --- /dev/null +++ b/src/javax/microedition/io/file/FileConnection.java @@ -0,0 +1,90 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.microedition.io.file; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Enumeration; + +import javax.microedition.io.StreamConnection; + +public interface FileConnection extends StreamConnection +{ + public long availableSize(); + + public boolean canRead(); + + public boolean canWrite(); + + public void create(); + + public void delete(); + + public long directorySize(boolean includeSubDirs); + + public boolean exists(); + + public long fileSize(); + + public String getName(); + + public String getPath(); + + public String getURL(); + + public boolean isDirectory(); + + public boolean isHidden(); + + public boolean isOpen(); + + public long lastModified(); + + public Enumeration list(); + + public Enumeration list(String filter, boolean includeHidden); + + public void mkdir(); + + public DataInputStream openDataInputStream(); + + public DataOutputStream openDataOutputStream(); + + public InputStream openInputStream(); + + public OutputStream openOutputStream(); + + public OutputStream openOutputStream(long byteOffset); + + public void rename(); + + public void setFileConnection(String fileName); + + public void setHidden(boolean hidden); + + public void setReadable(boolean readable); + + public void setWritable(boolean writable); + + public long totalSize(); + + public void truncate(long byteOffset); + + public long usedSize(); +} \ No newline at end of file diff --git a/src/javax/microedition/io/file/FileSystemListener.java b/src/javax/microedition/io/file/FileSystemListener.java new file mode 100644 index 000000000..c99090855 --- /dev/null +++ b/src/javax/microedition/io/file/FileSystemListener.java @@ -0,0 +1,26 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.microedition.io.file; + +public interface FileSystemListener +{ + public static final int ROOT_ADDED = 1; + + public static final int ROOT_REMOVED = 0; + + public abstract void rootChanged(int state, String rootName); +} diff --git a/src/javax/microedition/io/file/FileSystemRegistry.java b/src/javax/microedition/io/file/FileSystemRegistry.java new file mode 100644 index 000000000..7f929e0cd --- /dev/null +++ b/src/javax/microedition/io/file/FileSystemRegistry.java @@ -0,0 +1,28 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.microedition.io.file; + +import java.util.Enumeration; + +public abstract class FileSystemRegistry +{ + public abstract boolean addFileSystemListener(FileSystemListener listener); + + public abstract Enumeration listRoots(); + + public abstract boolean removeFileSystemListener(FileSystemListener listener); +} diff --git a/src/javax/microedition/io/file/IllegalModeException.java b/src/javax/microedition/io/file/IllegalModeException.java new file mode 100644 index 000000000..52a1def26 --- /dev/null +++ b/src/javax/microedition/io/file/IllegalModeException.java @@ -0,0 +1,24 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.microedition.io.file; + +public class IllegalModeException extends RuntimeException +{ + public IllegalModeException() {} + + public IllegalModeException(String detailMessage) { System.out.println("IllegalModeException: " + detailMessage); } +} From f34c90181805e2dfb05859b5d5a384d05343765c Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sat, 11 Jun 2022 16:29:56 -0300 Subject: [PATCH 04/23] javax: bluetooth: Stub some missing classes and interfaces. Those files allow games like 3D Formula Extreeme! to boot. Code based off of Java's ME JSR Community Process docs as well. --- src/javax/bluetooth/DeviceClass.java | 29 ++++++++++++ src/javax/bluetooth/DiscoveryAgent.java | 43 ++++++++++++++++++ src/javax/bluetooth/DiscoveryListener.java | 45 +++++++++++++++++++ src/javax/bluetooth/L2CAPConnection.java | 39 ++++++++++++++++ .../bluetooth/L2CAPConnectionNotifier.java | 28 ++++++++++++ src/javax/bluetooth/LocalDevice.java | 45 +++++++++++++++++++ src/javax/bluetooth/UUID.java | 32 +++++++++++++ 7 files changed, 261 insertions(+) create mode 100644 src/javax/bluetooth/DeviceClass.java create mode 100644 src/javax/bluetooth/DiscoveryAgent.java create mode 100644 src/javax/bluetooth/DiscoveryListener.java create mode 100644 src/javax/bluetooth/L2CAPConnection.java create mode 100644 src/javax/bluetooth/L2CAPConnectionNotifier.java create mode 100644 src/javax/bluetooth/LocalDevice.java create mode 100644 src/javax/bluetooth/UUID.java diff --git a/src/javax/bluetooth/DeviceClass.java b/src/javax/bluetooth/DeviceClass.java new file mode 100644 index 000000000..c3e1b9d46 --- /dev/null +++ b/src/javax/bluetooth/DeviceClass.java @@ -0,0 +1,29 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +public abstract class DeviceClass +{ + + public DeviceClass(int record) { System.out.println("DeviceClass record:" + record); } + + public abstract int getMajorDeviceClass(); + + public abstract int getMinorDeviceClass(); + + public abstract int getServiceClasses(); +} diff --git a/src/javax/bluetooth/DiscoveryAgent.java b/src/javax/bluetooth/DiscoveryAgent.java new file mode 100644 index 000000000..449dc0f20 --- /dev/null +++ b/src/javax/bluetooth/DiscoveryAgent.java @@ -0,0 +1,43 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +public abstract class DiscoveryAgent +{ + + public static final int CACHED = 0; + + public static final int GIAC = 10390323; + + public static final int LIAC = 10390272; + + public static final int NOT_DISCOVERABLE = 0; + + public static final int PREKNOWN = 1; + + public abstract boolean cancelInquiry(DiscoveryListener listener); + + public abstract boolean cancelServiceSearch(int transID); + + public abstract RemoteDevice[] retrieveDevices(int option); + + public abstract int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener discListener); + + public abstract String selectService(UUID uuid, int security, boolean master); + + public abstract boolean startInquiry(int accessCode, DiscoveryListener listener); +} diff --git a/src/javax/bluetooth/DiscoveryListener.java b/src/javax/bluetooth/DiscoveryListener.java new file mode 100644 index 000000000..580c099b4 --- /dev/null +++ b/src/javax/bluetooth/DiscoveryListener.java @@ -0,0 +1,45 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +public abstract interface DiscoveryListener +{ + + public static int INQUIRY_COMPLETED = 0; + + public static int INQUIRY_ERROR = 7; + + public static int INQUIRY_TERMINATED = 5; + + public static int SERVICE_SEARCH_COMPLETED = 1; + + public static int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 6; + + public static int SERVICE_SEARCH_ERROR = 3; + + public static int SERVICE_SEARCH_NO_RECORDS = 4; + + public static int SERVICE_SEARCH_TERMINATED = 2; + + public abstract void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod); + + public abstract void inquiryCompleted(int discType); + + public abstract void servicesDiscovered(int transID, ServiceRecord[] servRecord); + + public abstract void serviceSearchCompleted(int transID, int respCode); +} diff --git a/src/javax/bluetooth/L2CAPConnection.java b/src/javax/bluetooth/L2CAPConnection.java new file mode 100644 index 000000000..7752ffba4 --- /dev/null +++ b/src/javax/bluetooth/L2CAPConnection.java @@ -0,0 +1,39 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +import java.io.IOException; + +import javax.microedition.io.Connection; + +public interface L2CAPConnection extends Connection +{ + + public static final int DEFAULT_MTU = 672; + + public static final int MINIMUM_MTU = 48; + + public int getTransmitMTU() throws IOException; + + public int getReceiveMTU() throws IOException; + + public void send(byte[] data) throws IOException; + + public int receive(byte[] inBuf) throws IOException; + + public boolean ready() throws IOException; +} diff --git a/src/javax/bluetooth/L2CAPConnectionNotifier.java b/src/javax/bluetooth/L2CAPConnectionNotifier.java new file mode 100644 index 000000000..e68a477f4 --- /dev/null +++ b/src/javax/bluetooth/L2CAPConnectionNotifier.java @@ -0,0 +1,28 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +import java.io.IOException; + +import javax.microedition.io.Connection; + +public interface L2CAPConnectionNotifier extends Connection +{ + + public L2CAPConnection acceptAndOpen() throws IOException; + +} diff --git a/src/javax/bluetooth/LocalDevice.java b/src/javax/bluetooth/LocalDevice.java new file mode 100644 index 000000000..4ef936480 --- /dev/null +++ b/src/javax/bluetooth/LocalDevice.java @@ -0,0 +1,45 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +import javax.microedition.io.Connection; + + +public abstract class LocalDevice +{ + public abstract String getBluetoothAddress(); + + public abstract DeviceClass getDeviceClass(); + + public abstract int getDiscoverable(); + + public abstract DiscoveryAgent getDiscoveryAgent(); + + public abstract String getFriendlyName(); + + public abstract LocalDevice getLocalDevice(); + + public abstract String getProperty(String property); + + public abstract ServiceRecord getRecord(Connection notifier); + + public static boolean isPowerOn() { return false; /* We won't have functional Bluetooth yet */ } + + public abstract boolean setDiscoverable(int mode); + + public abstract void updateRecord(ServiceRecord srvRecord); +} diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java new file mode 100644 index 000000000..7788cf2e9 --- /dev/null +++ b/src/javax/bluetooth/UUID.java @@ -0,0 +1,32 @@ + +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.bluetooth; + +public abstract class UUID +{ + public UUID(long uuidValue) { System.out.println("UUID Value:" + uuidValue); } + + public UUID(String uuidValue, boolean shortUUID) { System.out.println("UUID Value:" + uuidValue); } + + public abstract boolean equals(Object value); + + public abstract int hashCode(); + + public abstract String toString(); +} + \ No newline at end of file From ac0f2dc7e4963dfc2cbcbee4ba8193007ee56482 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 01:13:47 -0300 Subject: [PATCH 05/23] javax: io: Update the file/ folder. The implementations were mostly in line with the javadocs as of the previous commit. This one makes them nearly identical to the docs. --- .../io/file/ConnectionClosedException.java | 4 +- .../microedition/io/file/FileConnection.java | 74 +++++++++++-------- .../io/file/FileSystemListener.java | 7 +- .../io/file/FileSystemRegistry.java | 12 ++- .../io/file/IllegalModeException.java | 4 +- 5 files changed, 61 insertions(+), 40 deletions(-) diff --git a/src/javax/microedition/io/file/ConnectionClosedException.java b/src/javax/microedition/io/file/ConnectionClosedException.java index 02acd718e..e2ae25376 100644 --- a/src/javax/microedition/io/file/ConnectionClosedException.java +++ b/src/javax/microedition/io/file/ConnectionClosedException.java @@ -18,7 +18,9 @@ public class ConnectionClosedException extends RuntimeException { - public ConnectionClosedException() {} + public ConnectionClosedException() { } /* Constructs an instance of the class with its stack trace */ + /* Constructs an instance of the class with its stack trace and message */ public ConnectionClosedException(String detailMessage) { System.out.println("ConnectionClosedException: " + detailMessage); } + } diff --git a/src/javax/microedition/io/file/FileConnection.java b/src/javax/microedition/io/file/FileConnection.java index 9eed4ed5c..f9b7a51cd 100644 --- a/src/javax/microedition/io/file/FileConnection.java +++ b/src/javax/microedition/io/file/FileConnection.java @@ -16,6 +16,7 @@ */ package javax.microedition.io.file; +import java.io.IOException; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.InputStream; @@ -26,65 +27,76 @@ public interface FileConnection extends StreamConnection { - public long availableSize(); + long availableSize() throws SecurityException, IllegalModeException, ConnectionClosedException; - public boolean canRead(); + boolean canRead() throws SecurityException, IllegalModeException, ConnectionClosedException; - public boolean canWrite(); + boolean canWrite() throws SecurityException, IllegalModeException, ConnectionClosedException; - public void create(); + void create() throws IOException, SecurityException, IllegalModeException; - public void delete(); + void delete() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public long directorySize(boolean includeSubDirs); + long directorySize(boolean includeSubDirs) throws IOException, SecurityException, IllegalModeException, + ConnectionClosedException; - public boolean exists(); + boolean exists() throws SecurityException, IllegalModeException, ConnectionClosedException; - public long fileSize(); + long fileSize() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public String getName(); + String getName(); - public String getPath(); + String getPath(); - public String getURL(); + String getURL(); - public boolean isDirectory(); + boolean isDirectory() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public boolean isHidden(); + boolean isHidden() throws SecurityException, IllegalModeException, ConnectionClosedException; - public boolean isOpen(); + boolean isOpen(); - public long lastModified(); + long lastModified() throws SecurityException, IllegalModeException, ConnectionClosedException; - public Enumeration list(); + Enumeration list() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public Enumeration list(String filter, boolean includeHidden); + Enumeration list(String filter, boolean includeHidden) throws NullPointerException, IllegalArgumentException, + IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public void mkdir(); + void mkdir() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public DataInputStream openDataInputStream(); + @Override /* Throws IOException in the docs, but not on the overriden class */ + DataInputStream openDataInputStream() throws SecurityException, IllegalModeException; - public DataOutputStream openDataOutputStream(); + @Override /* Throws IOException in the docs, but not on the overriden class */ + DataOutputStream openDataOutputStream() throws SecurityException, IllegalModeException; - public InputStream openInputStream(); + @Override /* Throws IOException in the docs, but not on the overriden class */ + InputStream openInputStream() throws SecurityException, IllegalModeException; - public OutputStream openOutputStream(); + @Override /* Throws IOException in the docs, but not on the overriden class */ + OutputStream openOutputStream() throws SecurityException, IllegalModeException; - public OutputStream openOutputStream(long byteOffset); + OutputStream openOutputStream(long byteOffset) throws IOException, SecurityException, IllegalModeException, + IllegalArgumentException; - public void rename(); + void rename(String newName) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, + NullPointerException, IllegalArgumentException; - public void setFileConnection(String fileName); + void setFileConnection(String fileName) throws IOException, SecurityException, NullPointerException, + IllegalArgumentException; - public void setHidden(boolean hidden); + void setHidden(boolean hidden) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public void setReadable(boolean readable); + void setReadable(boolean readable) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public void setWritable(boolean writable); + void setWritable(boolean writable) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - public long totalSize(); + long totalSize() throws SecurityException, IllegalModeException, ConnectionClosedException; - public void truncate(long byteOffset); + void truncate(long byteOffset) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, + IllegalArgumentException; + + long usedSize() throws SecurityException, IllegalModeException, ConnectionClosedException; - public long usedSize(); } \ No newline at end of file diff --git a/src/javax/microedition/io/file/FileSystemListener.java b/src/javax/microedition/io/file/FileSystemListener.java index c99090855..a4d149bd5 100644 --- a/src/javax/microedition/io/file/FileSystemListener.java +++ b/src/javax/microedition/io/file/FileSystemListener.java @@ -18,9 +18,10 @@ public interface FileSystemListener { - public static final int ROOT_ADDED = 1; + static final int ROOT_ADDED = 0; - public static final int ROOT_REMOVED = 0; + static final int ROOT_REMOVED = 1; - public abstract void rootChanged(int state, String rootName); + void rootChanged(int state, String rootName) throws NullPointerException, IllegalArgumentException; + } diff --git a/src/javax/microedition/io/file/FileSystemRegistry.java b/src/javax/microedition/io/file/FileSystemRegistry.java index 7f929e0cd..99e8ecbfe 100644 --- a/src/javax/microedition/io/file/FileSystemRegistry.java +++ b/src/javax/microedition/io/file/FileSystemRegistry.java @@ -18,11 +18,15 @@ import java.util.Enumeration; -public abstract class FileSystemRegistry +public class FileSystemRegistry extends Object { - public abstract boolean addFileSystemListener(FileSystemListener listener); + Enumeration roots; /* A zero-length Enumeration to be used below */ - public abstract Enumeration listRoots(); + public static boolean addFileSystemListener(FileSystemListener listener) throws SecurityException, + NullPointerException { return false; } /* Returns if the fileSystemListener was added, similar for the remove below */ + + public Enumeration listRoots() { return roots; }; /*If no roots are found, or it's not supported, return a zero-len enum*/ + + public static boolean removeFileSystemListener(FileSystemListener listener) throws NullPointerException { return false; }; - public abstract boolean removeFileSystemListener(FileSystemListener listener); } diff --git a/src/javax/microedition/io/file/IllegalModeException.java b/src/javax/microedition/io/file/IllegalModeException.java index 52a1def26..985b383df 100644 --- a/src/javax/microedition/io/file/IllegalModeException.java +++ b/src/javax/microedition/io/file/IllegalModeException.java @@ -18,7 +18,9 @@ public class IllegalModeException extends RuntimeException { - public IllegalModeException() {} + public IllegalModeException() { } /* Constructs an instance of the class with its stack trace */ + /* Constructs an instance of the class with its stack trace and message */ public IllegalModeException(String detailMessage) { System.out.println("IllegalModeException: " + detailMessage); } + } From 0522ab439946cdc1e95699ab4a06a40112198536 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 01:29:19 -0300 Subject: [PATCH 06/23] freej2me: libretro: Make the pointer position calc more readable. --- src/org/recompile/freej2me/Libretro.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/recompile/freej2me/Libretro.java b/src/org/recompile/freej2me/Libretro.java index 29270ca05..bf52bde76 100644 --- a/src/org/recompile/freej2me/Libretro.java +++ b/src/org/recompile/freej2me/Libretro.java @@ -185,7 +185,7 @@ public void run() } else { - Mobile.getPlatform().pointerReleased(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerReleased(lcdWidth-mousey, mousex); } break; @@ -198,7 +198,7 @@ public void run() } else { - Mobile.getPlatform().pointerPressed(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerPressed(lcdWidth-mousey, mousex); } break; @@ -211,7 +211,7 @@ public void run() } else { - Mobile.getPlatform().pointerDragged(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerDragged(lcdWidth-mousey, mousex); } break; From 2086bc4e67d6880bd4bc085603cf14894ea91aa0 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 03:48:39 -0300 Subject: [PATCH 07/23] src: javax: Stub the obex folder. This folder is a prerequisite for some of the incoming implementations of the recent bluetooth files, which even in their mostly stubbed state still needs these obex files to be present. --- src/javax/obex/Authenticator.java | 27 ++++++ src/javax/obex/ClientSession.java | 47 +++++++++++ src/javax/obex/HeaderSet.java | 59 +++++++++++++ src/javax/obex/Operation.java | 35 ++++++++ src/javax/obex/PasswordAuthentication.java | 35 ++++++++ src/javax/obex/ResponseCodes.java | 97 ++++++++++++++++++++++ src/javax/obex/ServerRequestHandler.java | 48 +++++++++++ src/javax/obex/SessionNotifier.java | 32 +++++++ 8 files changed, 380 insertions(+) create mode 100644 src/javax/obex/Authenticator.java create mode 100644 src/javax/obex/ClientSession.java create mode 100644 src/javax/obex/HeaderSet.java create mode 100644 src/javax/obex/Operation.java create mode 100644 src/javax/obex/PasswordAuthentication.java create mode 100644 src/javax/obex/ResponseCodes.java create mode 100644 src/javax/obex/ServerRequestHandler.java create mode 100644 src/javax/obex/SessionNotifier.java diff --git a/src/javax/obex/Authenticator.java b/src/javax/obex/Authenticator.java new file mode 100644 index 000000000..b69e70dc6 --- /dev/null +++ b/src/javax/obex/Authenticator.java @@ -0,0 +1,27 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +public interface Authenticator +{ + + PasswordAuthentication onAuthenticationChallenge(String description, + boolean isUserIdRequired, boolean isFullAccess); + + byte[] onAuthenticationResponse(byte[] userName); + +} diff --git a/src/javax/obex/ClientSession.java b/src/javax/obex/ClientSession.java new file mode 100644 index 000000000..4932143ce --- /dev/null +++ b/src/javax/obex/ClientSession.java @@ -0,0 +1,47 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +import java.io.IOException; + +import javax.microedition.io.Connection; + +public interface ClientSession extends Connection +{ + + void setAuthenticator(Authenticator auth) throws NullPointerException; + + HeaderSet createHeaderSet(); + + void setConnectionID(long id) throws IllegalArgumentException ; + + long getConnectionID(); + + HeaderSet connect(HeaderSet headers) throws IOException, IllegalArgumentException; + + HeaderSet disconnect(HeaderSet headers) throws IOException, IllegalArgumentException; + + HeaderSet setPath(HeaderSet headers, boolean backup, boolean create) throws IOException, + IllegalArgumentException; + + HeaderSet delete(HeaderSet headers) throws IOException, IllegalArgumentException; + + Operation get(HeaderSet headers) throws IOException, IllegalArgumentException; + + Operation put(HeaderSet headers) throws IOException, IllegalArgumentException; + +} diff --git a/src/javax/obex/HeaderSet.java b/src/javax/obex/HeaderSet.java new file mode 100644 index 000000000..dd022694c --- /dev/null +++ b/src/javax/obex/HeaderSet.java @@ -0,0 +1,59 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +import java.io.IOException; + +public interface HeaderSet +{ + + static final int COUNT = 0xC0; + + static final int NAME = 0x01; + + static final int TYPE = 0x42; + + static final int LENGTH = 0xC3; + + static final int TIME_ISO_8601 = 0x44; + + static final int TIME_4_BYTE = 0xC4; + + static final int DESCRIPTION = 0x05; + + static final int TARGET = 0x46; + + static final int HTTP = 0x47; + + static final int WHO = 0x4A; + + static final int OBJECT_CLASS = 0x4F; + + static final int APPLICATION_PARAMETER = 0x4C; + + void setHeader(int headerID, Object headerValue) throws IllegalArgumentException; + + Object getHeader(int headerID) throws IllegalArgumentException, IOException; + + int[] getHeaderList() throws IOException; + + void createAuthenticationChallenge(java.lang.String realm, boolean userID, + boolean access); + + int getResponseCode() throws IOException; + +} diff --git a/src/javax/obex/Operation.java b/src/javax/obex/Operation.java new file mode 100644 index 000000000..dd29cee5b --- /dev/null +++ b/src/javax/obex/Operation.java @@ -0,0 +1,35 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +import java.io.IOException; + +import javax.microedition.io.Connection; + +public interface Operation extends Connection +{ + + void abort() throws IOException; + + HeaderSet getReceivedHeaders() throws IOException; + + void sendHeaders(HeaderSet headers) throws IOException, NullPointerException, + IllegalArgumentException; + + int getResponseCode() throws IOException; + +} diff --git a/src/javax/obex/PasswordAuthentication.java b/src/javax/obex/PasswordAuthentication.java new file mode 100644 index 000000000..1401c7639 --- /dev/null +++ b/src/javax/obex/PasswordAuthentication.java @@ -0,0 +1,35 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +public class PasswordAuthentication extends Object +{ + + byte[] name, pass; + + public PasswordAuthentication(byte[] userName, byte[] password) throws + NullPointerException + { + name = userName; + pass = password; + } + + public byte[] getUserName() { return name; } + + public byte[] getPassword() { return pass; } + +} diff --git a/src/javax/obex/ResponseCodes.java b/src/javax/obex/ResponseCodes.java new file mode 100644 index 000000000..468fa9820 --- /dev/null +++ b/src/javax/obex/ResponseCodes.java @@ -0,0 +1,97 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +public class ResponseCodes extends Object +{ + + public static final int OBEX_HTTP_OK = 0xA0; + + public static final int OBEX_HTTP_CREATED = 0xA1; + + public static final int OBEX_HTTP_ACCEPTED = 0xA2; + + public static final int OBEX_HTTP_NOT_AUTHORITATIVE = 0xA3; + + public static final int OBEX_HTTP_NO_CONTENT = 0xA4; + + public static final int OBEX_HTTP_RESET = 0xA5; + + public static final int OBEX_HTTP_PARTIAL = 0xA6; + + public static final int OBEX_HTTP_MULT_CHOICE = 0xB0; + + public static final int OBEX_HTTP_MOVED_PERM = 0xB1; + + public static final int OBEX_HTTP_MOVED_TEMP = 0xB2; + + public static final int OBEX_HTTP_SEE_OTHER = 0xB3; + + public static final int OBEX_HTTP_NOT_MODIFIED = 0xB4; + + public static final int OBEX_HTTP_USE_PROXY = 0xB5; + + public static final int OBEX_HTTP_BAD_REQUEST = 0xC0; + + public static final int OBEX_HTTP_UNAUTHORIZED = 0xC1; + + public static final int OBEX_HTTP_PAYMENT_REQUIRED = 0xC2; + + public static final int OBEX_HTTP_FORBIDDEN = 0xC3; + + public static final int OBEX_HTTP_NOT_FOUND = 0xC4; + + public static final int OBEX_HTTP_BAD_METHOD = 0xC5; + + public static final int OBEX_HTTP_NOT_ACCEPTABLE = 0xC6; + + public static final int OBEX_HTTP_PROXY_AUTH = 0xC7; + + public static final int OBEX_HTTP_TIMEOUT = 0xC8; + + public static final int OBEX_HTTP_CONFLICT = 0xC9; + + public static final int OBEX_HTTP_GONE = 0xCA; + + public static final int OBEX_HTTP_LENGTH_REQUIRED = 0xCB; + + public static final int OBEX_HTTP_PRECON_FAILED = 0xCC; + + public static final int OBEX_HTTP_ENTITY_TOO_LARGE = 0xCD; + + public static final int OBEX_HTTP_REQ_TOO_LARGE = 0xCE; + + public static final int OBEX_HTTP_UNSUPPORTED_TYPE = 0xCF; + + public static final int OBEX_HTTP_INTERNAL_ERROR = 0xD0; + + public static final int OBEX_HTTP_NOT_IMPLEMENTED = 0xD1; + + public static final int OBEX_HTTP_BAD_GATEWAY = 0xD2; + + public static final int OBEX_HTTP_UNAVAILABLE = 0xD3; + + public static final int OBEX_HTTP_GATEWAY_TIMEOUT = 0xD4; + + public static final int OBEX_HTTP_VERSION = 0xD5; + + public static final int OBEX_DATABASE_FULL = 0xE0; + + public static final int OBEX_DATABASE_LOCKED = 0xE1; + + +} diff --git a/src/javax/obex/ServerRequestHandler.java b/src/javax/obex/ServerRequestHandler.java new file mode 100644 index 000000000..4bc645051 --- /dev/null +++ b/src/javax/obex/ServerRequestHandler.java @@ -0,0 +1,48 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +public class ServerRequestHandler extends Object +{ + + private long connectionID = -1; + + protected ServerRequestHandler() { this.connectionID = -1; }; + + public final HeaderSet createHeaderSet() { return null; } + + public void setConnectionID(long id) throws IllegalArgumentException { } + + public long getConnectionID() { return this.connectionID; } + + public int onConnect(HeaderSet request, HeaderSet reply) + { return ResponseCodes.OBEX_HTTP_OK; } + + public void onDisconnect(HeaderSet request, HeaderSet reply) { } + + public int onSetPath(HeaderSet request, HeaderSet reply, boolean backup, + boolean create) { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + + public int onDelete(HeaderSet request, HeaderSet reply) + { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + + public int onPut(Operation op) + { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + + public void onAuthenticationFailure(byte[] userName) { } + +} diff --git a/src/javax/obex/SessionNotifier.java b/src/javax/obex/SessionNotifier.java new file mode 100644 index 000000000..cb5cdd2f6 --- /dev/null +++ b/src/javax/obex/SessionNotifier.java @@ -0,0 +1,32 @@ +/* + This file is part of FreeJ2ME. + + FreeJ2ME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FreeJ2ME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeJ2ME. If not, see http://www.gnu.org/licenses/ +*/ +package javax.obex; + +import java.io.IOException; + +import javax.microedition.io.Connection; + +public interface SessionNotifier extends Connection +{ + + Connection acceptAndOpen(ServerRequestHandler handler) throws IOException, + NullPointerException; + + Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth) + throws IOException, NullPointerException; + +} From f9f113f00ceab7235103717583da5667400b499d Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 03:50:33 -0300 Subject: [PATCH 08/23] javax: bluetooth: Finish the file additions. The code in them should now be mostly identical to the javadocs. --- src/javax/bluetooth/DeviceClass.java | 9 +-- src/javax/bluetooth/DiscoveryAgent.java | 25 +++++---- src/javax/bluetooth/DiscoveryListener.java | 27 ++++----- src/javax/bluetooth/L2CAPConnection.java | 16 +++--- .../bluetooth/L2CAPConnectionNotifier.java | 2 +- src/javax/bluetooth/LocalDevice.java | 55 +++++++++++++++---- src/javax/bluetooth/UUID.java | 16 ++++-- 7 files changed, 95 insertions(+), 55 deletions(-) diff --git a/src/javax/bluetooth/DeviceClass.java b/src/javax/bluetooth/DeviceClass.java index c3e1b9d46..ba7a71cc9 100644 --- a/src/javax/bluetooth/DeviceClass.java +++ b/src/javax/bluetooth/DeviceClass.java @@ -16,14 +16,15 @@ */ package javax.bluetooth; -public abstract class DeviceClass +public class DeviceClass extends Object { public DeviceClass(int record) { System.out.println("DeviceClass record:" + record); } - public abstract int getMajorDeviceClass(); + public int getMajorDeviceClass() { return 0x200; } - public abstract int getMinorDeviceClass(); + public int getMinorDeviceClass() { return 0x04; } + + public int getServiceClasses() { return 0x22000 | 0x100000; } - public abstract int getServiceClasses(); } diff --git a/src/javax/bluetooth/DiscoveryAgent.java b/src/javax/bluetooth/DiscoveryAgent.java index 449dc0f20..e40d9701e 100644 --- a/src/javax/bluetooth/DiscoveryAgent.java +++ b/src/javax/bluetooth/DiscoveryAgent.java @@ -16,28 +16,29 @@ */ package javax.bluetooth; -public abstract class DiscoveryAgent +public class DiscoveryAgent extends Object { - public static final int CACHED = 0; + public static final int CACHED = 0x00; - public static final int GIAC = 10390323; + public static final int GIAC = 0x9E8B33; - public static final int LIAC = 10390272; + public static final int LIAC = 0x9E8B00; - public static final int NOT_DISCOVERABLE = 0; + public static final int NOT_DISCOVERABLE = 0x00; - public static final int PREKNOWN = 1; + public static final int PREKNOWN = 0x01; - public abstract boolean cancelInquiry(DiscoveryListener listener); + public boolean cancelInquiry(DiscoveryListener listener) { return false; } - public abstract boolean cancelServiceSearch(int transID); + public boolean cancelServiceSearch(int transID) { return false; } - public abstract RemoteDevice[] retrieveDevices(int option); + public RemoteDevice[] retrieveDevices(int option) { return null; } - public abstract int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener discListener); + public int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener discListener) { return 0; } - public abstract String selectService(UUID uuid, int security, boolean master); + public String selectService(UUID uuid, int security, boolean master) { return null; } - public abstract boolean startInquiry(int accessCode, DiscoveryListener listener); + public boolean startInquiry(int accessCode, DiscoveryListener listener) { return false; } + } diff --git a/src/javax/bluetooth/DiscoveryListener.java b/src/javax/bluetooth/DiscoveryListener.java index 580c099b4..3071074ca 100644 --- a/src/javax/bluetooth/DiscoveryListener.java +++ b/src/javax/bluetooth/DiscoveryListener.java @@ -16,30 +16,31 @@ */ package javax.bluetooth; -public abstract interface DiscoveryListener +public interface DiscoveryListener { - public static int INQUIRY_COMPLETED = 0; + static final int INQUIRY_COMPLETED = 0x00; - public static int INQUIRY_ERROR = 7; + static final int INQUIRY_ERROR = 0x07; - public static int INQUIRY_TERMINATED = 5; + static final int INQUIRY_TERMINATED = 0x05; - public static int SERVICE_SEARCH_COMPLETED = 1; + static final int SERVICE_SEARCH_COMPLETED = 0x01; - public static int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 6; + static final int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06; - public static int SERVICE_SEARCH_ERROR = 3; + static final int SERVICE_SEARCH_ERROR = 0x03; - public static int SERVICE_SEARCH_NO_RECORDS = 4; + static final int SERVICE_SEARCH_NO_RECORDS = 0x04; - public static int SERVICE_SEARCH_TERMINATED = 2; + static final int SERVICE_SEARCH_TERMINATED = 0x02; - public abstract void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod); + void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod); - public abstract void inquiryCompleted(int discType); + void inquiryCompleted(int discType); - public abstract void servicesDiscovered(int transID, ServiceRecord[] servRecord); + void servicesDiscovered(int transID, ServiceRecord[] servRecord); - public abstract void serviceSearchCompleted(int transID, int respCode); + void serviceSearchCompleted(int transID, int respCode); + } diff --git a/src/javax/bluetooth/L2CAPConnection.java b/src/javax/bluetooth/L2CAPConnection.java index 7752ffba4..0ccb456de 100644 --- a/src/javax/bluetooth/L2CAPConnection.java +++ b/src/javax/bluetooth/L2CAPConnection.java @@ -17,23 +17,25 @@ package javax.bluetooth; import java.io.IOException; +import java.io.InterruptedIOException; import javax.microedition.io.Connection; public interface L2CAPConnection extends Connection { - public static final int DEFAULT_MTU = 672; + static final int DEFAULT_MTU = 0x02A0; - public static final int MINIMUM_MTU = 48; + static final int MINIMUM_MTU = 0x30; - public int getTransmitMTU() throws IOException; + int getTransmitMTU() throws IOException; - public int getReceiveMTU() throws IOException; + int getReceiveMTU() throws IOException; - public void send(byte[] data) throws IOException; + void send(byte[] data) throws IOException, NullPointerException; - public int receive(byte[] inBuf) throws IOException; + int receive(byte[] inBuf) throws IOException, NullPointerException, InterruptedIOException; + + boolean ready() throws IOException; - public boolean ready() throws IOException; } diff --git a/src/javax/bluetooth/L2CAPConnectionNotifier.java b/src/javax/bluetooth/L2CAPConnectionNotifier.java index e68a477f4..bd77216fd 100644 --- a/src/javax/bluetooth/L2CAPConnectionNotifier.java +++ b/src/javax/bluetooth/L2CAPConnectionNotifier.java @@ -23,6 +23,6 @@ public interface L2CAPConnectionNotifier extends Connection { - public L2CAPConnection acceptAndOpen() throws IOException; + L2CAPConnection acceptAndOpen() throws IOException, ServiceRegistrationException, BluetoothStateException; } diff --git a/src/javax/bluetooth/LocalDevice.java b/src/javax/bluetooth/LocalDevice.java index 4ef936480..03aa40ce1 100644 --- a/src/javax/bluetooth/LocalDevice.java +++ b/src/javax/bluetooth/LocalDevice.java @@ -18,28 +18,59 @@ import javax.microedition.io.Connection; +import java.util.Hashtable; -public abstract class LocalDevice +import javax.obex.SessionNotifier; + +public class LocalDevice extends Object { - public abstract String getBluetoothAddress(); - public abstract DeviceClass getDeviceClass(); + private static LocalDevice locDevc; + + private static DiscoveryAgent disAgnt; + + private static DeviceClass devcCls; + + private static ServiceRecord srvcRcd; + + private static Hashtable properties = new Hashtable(); + + static { + properties.put("bluetooth.api.version", "0.0"); + properties.put("bluetooth.master.switch", "false"); + properties.put("bluetooth.sd.attr.retrievable.max", "0"); + properties.put("bluetooth.connected.devices.max", "0"); + properties.put("bluetooth.l2cap.receiveMTU.max", "0"); + properties.put("bluetooth.sd.trans.max", "0"); + properties.put("bluetooth.connected.inquiry.scan", "false"); + properties.put("bluetooth.connected.page.scan", "false"); + properties.put("bluetooth.connected.inquiry", "false"); + properties.put("bluetooth.connected.page", "false"); + } + + public static String getBluetoothAddress() throws BluetoothStateException { return "000000000000"; } + + public static DeviceClass getDeviceClass() { return devcCls; } + + public static int getDiscoverable() { return DiscoveryAgent.NOT_DISCOVERABLE; } - public abstract int getDiscoverable(); + public static DiscoveryAgent getDiscoveryAgent() { return disAgnt; } - public abstract DiscoveryAgent getDiscoveryAgent(); + public static String getFriendlyName() { return "noDevice"; } - public abstract String getFriendlyName(); + public static LocalDevice getLocalDevice() throws BluetoothStateException { return locDevc; } - public abstract LocalDevice getLocalDevice(); + public static String getProperty(String property) { return properties.get(property); } - public abstract String getProperty(String property); + public static ServiceRecord getRecord(Connection notifier) throws IllegalArgumentException, + NullPointerException { return srvcRcd; } - public abstract ServiceRecord getRecord(Connection notifier); + public static boolean isPowerOn() { return false; } /* We won't have functional Bluetooth yet */ - public static boolean isPowerOn() { return false; /* We won't have functional Bluetooth yet */ } + public static boolean setDiscoverable(int mode) throws IllegalArgumentException, + BluetoothStateException { return false; } - public abstract boolean setDiscoverable(int mode); + public static void updateRecord(ServiceRecord srvRecord) throws NullPointerException, + IllegalArgumentException, ServiceRegistrationException { } - public abstract void updateRecord(ServiceRecord srvRecord); } diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 7788cf2e9..2f2dcfe4f 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -17,16 +17,20 @@ */ package javax.bluetooth; -public abstract class UUID +public class UUID extends Object { - public UUID(long uuidValue) { System.out.println("UUID Value:" + uuidValue); } + UUID uuid; + private static final String BASE_UUID_VALUE = "0x0000000000001000800000805F9B34FB"; - public UUID(String uuidValue, boolean shortUUID) { System.out.println("UUID Value:" + uuidValue); } + public UUID(long uuidValue) throws IllegalArgumentException { System.out.println("UUID Value:" + uuidValue); } - public abstract boolean equals(Object value); + public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException, NullPointerException, + NumberFormatException { System.out.println("UUID Value:" + uuidValue); } - public abstract int hashCode(); + public boolean equals(Object value) { return false; } - public abstract String toString(); + public int hashCode() { return uuid.hashCode(); } + + public String toString() { return BASE_UUID_VALUE; } } \ No newline at end of file From dc1e467c91a70e1584abc23aa3632cdd82a4de3f Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 14:22:33 -0300 Subject: [PATCH 09/23] javax: bluetooth: Some cleanups to the files. --- src/javax/bluetooth/DeviceClass.java | 2 +- src/javax/bluetooth/DiscoveryAgent.java | 2 +- src/javax/bluetooth/LocalDevice.java | 2 +- src/javax/bluetooth/UUID.java | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/javax/bluetooth/DeviceClass.java b/src/javax/bluetooth/DeviceClass.java index ba7a71cc9..cd33d2672 100644 --- a/src/javax/bluetooth/DeviceClass.java +++ b/src/javax/bluetooth/DeviceClass.java @@ -16,7 +16,7 @@ */ package javax.bluetooth; -public class DeviceClass extends Object +public class DeviceClass { public DeviceClass(int record) { System.out.println("DeviceClass record:" + record); } diff --git a/src/javax/bluetooth/DiscoveryAgent.java b/src/javax/bluetooth/DiscoveryAgent.java index e40d9701e..d951ffe05 100644 --- a/src/javax/bluetooth/DiscoveryAgent.java +++ b/src/javax/bluetooth/DiscoveryAgent.java @@ -16,7 +16,7 @@ */ package javax.bluetooth; -public class DiscoveryAgent extends Object +public class DiscoveryAgent { public static final int CACHED = 0x00; diff --git a/src/javax/bluetooth/LocalDevice.java b/src/javax/bluetooth/LocalDevice.java index 03aa40ce1..4634ed754 100644 --- a/src/javax/bluetooth/LocalDevice.java +++ b/src/javax/bluetooth/LocalDevice.java @@ -22,7 +22,7 @@ import javax.obex.SessionNotifier; -public class LocalDevice extends Object +public class LocalDevice { private static LocalDevice locDevc; diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 2f2dcfe4f..8e5c77187 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -17,8 +17,9 @@ */ package javax.bluetooth; -public class UUID extends Object +public class UUID { + UUID uuid; private static final String BASE_UUID_VALUE = "0x0000000000001000800000805F9B34FB"; @@ -32,5 +33,6 @@ public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException public int hashCode() { return uuid.hashCode(); } public String toString() { return BASE_UUID_VALUE; } + } \ No newline at end of file From 424df513005ad855d9d2f0f2f19fd381ee529c4c Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 14:42:54 -0300 Subject: [PATCH 10/23] javax: io: Cleanups to the file/ folder. --- .../io/file/ConnectionClosedException.java | 1 + src/javax/microedition/io/file/FileConnection.java | 11 ++++++----- .../microedition/io/file/FileSystemListener.java | 1 + .../microedition/io/file/FileSystemRegistry.java | 1 + .../microedition/io/file/IllegalModeException.java | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/javax/microedition/io/file/ConnectionClosedException.java b/src/javax/microedition/io/file/ConnectionClosedException.java index e2ae25376..2ef8960bc 100644 --- a/src/javax/microedition/io/file/ConnectionClosedException.java +++ b/src/javax/microedition/io/file/ConnectionClosedException.java @@ -18,6 +18,7 @@ public class ConnectionClosedException extends RuntimeException { + public ConnectionClosedException() { } /* Constructs an instance of the class with its stack trace */ /* Constructs an instance of the class with its stack trace and message */ diff --git a/src/javax/microedition/io/file/FileConnection.java b/src/javax/microedition/io/file/FileConnection.java index f9b7a51cd..0b9c1e5ad 100644 --- a/src/javax/microedition/io/file/FileConnection.java +++ b/src/javax/microedition/io/file/FileConnection.java @@ -27,6 +27,7 @@ public interface FileConnection extends StreamConnection { + long availableSize() throws SecurityException, IllegalModeException, ConnectionClosedException; boolean canRead() throws SecurityException, IllegalModeException, ConnectionClosedException; @@ -65,16 +66,16 @@ Enumeration list(String filter, boolean includeHidden) throws NullPointerExcepti void mkdir() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - @Override /* Throws IOException in the docs, but not on the overriden class */ + @Override DataInputStream openDataInputStream() throws SecurityException, IllegalModeException; - @Override /* Throws IOException in the docs, but not on the overriden class */ + @Override DataOutputStream openDataOutputStream() throws SecurityException, IllegalModeException; - @Override /* Throws IOException in the docs, but not on the overriden class */ + @Override InputStream openInputStream() throws SecurityException, IllegalModeException; - @Override /* Throws IOException in the docs, but not on the overriden class */ + @Override OutputStream openOutputStream() throws SecurityException, IllegalModeException; OutputStream openOutputStream(long byteOffset) throws IOException, SecurityException, IllegalModeException, @@ -99,4 +100,4 @@ void truncate(long byteOffset) throws IOException, SecurityException, IllegalMod long usedSize() throws SecurityException, IllegalModeException, ConnectionClosedException; -} \ No newline at end of file +} diff --git a/src/javax/microedition/io/file/FileSystemListener.java b/src/javax/microedition/io/file/FileSystemListener.java index a4d149bd5..ca3d50f2d 100644 --- a/src/javax/microedition/io/file/FileSystemListener.java +++ b/src/javax/microedition/io/file/FileSystemListener.java @@ -18,6 +18,7 @@ public interface FileSystemListener { + static final int ROOT_ADDED = 0; static final int ROOT_REMOVED = 1; diff --git a/src/javax/microedition/io/file/FileSystemRegistry.java b/src/javax/microedition/io/file/FileSystemRegistry.java index 99e8ecbfe..66f2494c2 100644 --- a/src/javax/microedition/io/file/FileSystemRegistry.java +++ b/src/javax/microedition/io/file/FileSystemRegistry.java @@ -20,6 +20,7 @@ public class FileSystemRegistry extends Object { + Enumeration roots; /* A zero-length Enumeration to be used below */ public static boolean addFileSystemListener(FileSystemListener listener) throws SecurityException, diff --git a/src/javax/microedition/io/file/IllegalModeException.java b/src/javax/microedition/io/file/IllegalModeException.java index 985b383df..db966c27c 100644 --- a/src/javax/microedition/io/file/IllegalModeException.java +++ b/src/javax/microedition/io/file/IllegalModeException.java @@ -18,6 +18,7 @@ public class IllegalModeException extends RuntimeException { + public IllegalModeException() { } /* Constructs an instance of the class with its stack trace */ /* Constructs an instance of the class with its stack trace and message */ From d242d61486708bcc1e7611e915518f7b85c045f3 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 12 Jun 2022 14:48:45 -0300 Subject: [PATCH 11/23] src: javax: Minor cleanup on the obex folder. --- src/javax/obex/ResponseCodes.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/javax/obex/ResponseCodes.java b/src/javax/obex/ResponseCodes.java index 468fa9820..b01693b05 100644 --- a/src/javax/obex/ResponseCodes.java +++ b/src/javax/obex/ResponseCodes.java @@ -93,5 +93,4 @@ public class ResponseCodes extends Object public static final int OBEX_DATABASE_LOCKED = 0xE1; - } From 30ea5f002a95f942d45f9ad3f996f25cc4665f8b Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Tue, 14 Jun 2022 19:03:42 -0300 Subject: [PATCH 12/23] javax: io: More cleanups and adjustments to the file/ folder. --- .../io/file/ConnectionClosedException.java | 3 +-- .../microedition/io/file/FileConnection.java | 18 ++++++------------ .../io/file/FileSystemRegistry.java | 5 +++-- .../io/file/IllegalModeException.java | 3 +-- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/javax/microedition/io/file/ConnectionClosedException.java b/src/javax/microedition/io/file/ConnectionClosedException.java index 2ef8960bc..45b6ffc82 100644 --- a/src/javax/microedition/io/file/ConnectionClosedException.java +++ b/src/javax/microedition/io/file/ConnectionClosedException.java @@ -19,9 +19,8 @@ public class ConnectionClosedException extends RuntimeException { - public ConnectionClosedException() { } /* Constructs an instance of the class with its stack trace */ + public ConnectionClosedException() { } - /* Constructs an instance of the class with its stack trace and message */ public ConnectionClosedException(String detailMessage) { System.out.println("ConnectionClosedException: " + detailMessage); } } diff --git a/src/javax/microedition/io/file/FileConnection.java b/src/javax/microedition/io/file/FileConnection.java index 0b9c1e5ad..f1e7b8ae9 100644 --- a/src/javax/microedition/io/file/FileConnection.java +++ b/src/javax/microedition/io/file/FileConnection.java @@ -38,8 +38,7 @@ public interface FileConnection extends StreamConnection void delete() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - long directorySize(boolean includeSubDirs) throws IOException, SecurityException, IllegalModeException, - ConnectionClosedException; + long directorySize(boolean includeSubDirs) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; boolean exists() throws SecurityException, IllegalModeException, ConnectionClosedException; @@ -61,8 +60,7 @@ long directorySize(boolean includeSubDirs) throws IOException, SecurityException Enumeration list() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; - Enumeration list(String filter, boolean includeHidden) throws NullPointerException, IllegalArgumentException, - IOException, SecurityException, IllegalModeException, ConnectionClosedException; + Enumeration list(String filter, boolean includeHidden) throws NullPointerException, IllegalArgumentException, IOException, SecurityException, IllegalModeException, ConnectionClosedException; void mkdir() throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; @@ -78,14 +76,11 @@ Enumeration list(String filter, boolean includeHidden) throws NullPointerExcepti @Override OutputStream openOutputStream() throws SecurityException, IllegalModeException; - OutputStream openOutputStream(long byteOffset) throws IOException, SecurityException, IllegalModeException, - IllegalArgumentException; + OutputStream openOutputStream(long byteOffset) throws IOException, SecurityException, IllegalModeException, IllegalArgumentException; - void rename(String newName) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, - NullPointerException, IllegalArgumentException; + void rename(String newName) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, NullPointerException, IllegalArgumentException; - void setFileConnection(String fileName) throws IOException, SecurityException, NullPointerException, - IllegalArgumentException; + void setFileConnection(String fileName) throws IOException, SecurityException, NullPointerException, IllegalArgumentException; void setHidden(boolean hidden) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException; @@ -95,8 +90,7 @@ void setFileConnection(String fileName) throws IOException, SecurityException, N long totalSize() throws SecurityException, IllegalModeException, ConnectionClosedException; - void truncate(long byteOffset) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, - IllegalArgumentException; + void truncate(long byteOffset) throws IOException, SecurityException, IllegalModeException, ConnectionClosedException, IllegalArgumentException; long usedSize() throws SecurityException, IllegalModeException, ConnectionClosedException; diff --git a/src/javax/microedition/io/file/FileSystemRegistry.java b/src/javax/microedition/io/file/FileSystemRegistry.java index 66f2494c2..655fff876 100644 --- a/src/javax/microedition/io/file/FileSystemRegistry.java +++ b/src/javax/microedition/io/file/FileSystemRegistry.java @@ -23,11 +23,12 @@ public class FileSystemRegistry extends Object Enumeration roots; /* A zero-length Enumeration to be used below */ - public static boolean addFileSystemListener(FileSystemListener listener) throws SecurityException, - NullPointerException { return false; } /* Returns if the fileSystemListener was added, similar for the remove below */ + /* Returns true if the fileSystemListener was added. */ + public static boolean addFileSystemListener(FileSystemListener listener) throws SecurityException, NullPointerException { return false; } public Enumeration listRoots() { return roots; }; /*If no roots are found, or it's not supported, return a zero-len enum*/ + /* Returns true if the fileSystemListener was removed. */ public static boolean removeFileSystemListener(FileSystemListener listener) throws NullPointerException { return false; }; } diff --git a/src/javax/microedition/io/file/IllegalModeException.java b/src/javax/microedition/io/file/IllegalModeException.java index db966c27c..1d2973a66 100644 --- a/src/javax/microedition/io/file/IllegalModeException.java +++ b/src/javax/microedition/io/file/IllegalModeException.java @@ -19,9 +19,8 @@ public class IllegalModeException extends RuntimeException { - public IllegalModeException() { } /* Constructs an instance of the class with its stack trace */ + public IllegalModeException() { } - /* Constructs an instance of the class with its stack trace and message */ public IllegalModeException(String detailMessage) { System.out.println("IllegalModeException: " + detailMessage); } } From c14d5c4b55a149781f3f97209d1e966eb4d8fff8 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Tue, 14 Jun 2022 19:28:31 -0300 Subject: [PATCH 13/23] javax: obex: More adjustments to the obex files. --- src/javax/obex/Authenticator.java | 3 +-- src/javax/obex/ClientSession.java | 3 +-- src/javax/obex/HeaderSet.java | 3 +-- src/javax/obex/Operation.java | 3 +-- src/javax/obex/PasswordAuthentication.java | 3 +-- src/javax/obex/ServerRequestHandler.java | 12 ++++-------- src/javax/obex/SessionNotifier.java | 6 ++---- 7 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/javax/obex/Authenticator.java b/src/javax/obex/Authenticator.java index b69e70dc6..43d1b1daf 100644 --- a/src/javax/obex/Authenticator.java +++ b/src/javax/obex/Authenticator.java @@ -19,8 +19,7 @@ public interface Authenticator { - PasswordAuthentication onAuthenticationChallenge(String description, - boolean isUserIdRequired, boolean isFullAccess); + PasswordAuthentication onAuthenticationChallenge(String description, boolean isUserIdRequired, boolean isFullAccess); byte[] onAuthenticationResponse(byte[] userName); diff --git a/src/javax/obex/ClientSession.java b/src/javax/obex/ClientSession.java index 4932143ce..d1bafb16f 100644 --- a/src/javax/obex/ClientSession.java +++ b/src/javax/obex/ClientSession.java @@ -35,8 +35,7 @@ public interface ClientSession extends Connection HeaderSet disconnect(HeaderSet headers) throws IOException, IllegalArgumentException; - HeaderSet setPath(HeaderSet headers, boolean backup, boolean create) throws IOException, - IllegalArgumentException; + HeaderSet setPath(HeaderSet headers, boolean backup, boolean create) throws IOException, IllegalArgumentException; HeaderSet delete(HeaderSet headers) throws IOException, IllegalArgumentException; diff --git a/src/javax/obex/HeaderSet.java b/src/javax/obex/HeaderSet.java index dd022694c..edda0290d 100644 --- a/src/javax/obex/HeaderSet.java +++ b/src/javax/obex/HeaderSet.java @@ -51,8 +51,7 @@ public interface HeaderSet int[] getHeaderList() throws IOException; - void createAuthenticationChallenge(java.lang.String realm, boolean userID, - boolean access); + void createAuthenticationChallenge(java.lang.String realm, boolean userID, boolean access); int getResponseCode() throws IOException; diff --git a/src/javax/obex/Operation.java b/src/javax/obex/Operation.java index dd29cee5b..053c8d36b 100644 --- a/src/javax/obex/Operation.java +++ b/src/javax/obex/Operation.java @@ -27,8 +27,7 @@ public interface Operation extends Connection HeaderSet getReceivedHeaders() throws IOException; - void sendHeaders(HeaderSet headers) throws IOException, NullPointerException, - IllegalArgumentException; + void sendHeaders(HeaderSet headers) throws IOException, NullPointerException, IllegalArgumentException; int getResponseCode() throws IOException; diff --git a/src/javax/obex/PasswordAuthentication.java b/src/javax/obex/PasswordAuthentication.java index 1401c7639..49461778e 100644 --- a/src/javax/obex/PasswordAuthentication.java +++ b/src/javax/obex/PasswordAuthentication.java @@ -21,8 +21,7 @@ public class PasswordAuthentication extends Object byte[] name, pass; - public PasswordAuthentication(byte[] userName, byte[] password) throws - NullPointerException + public PasswordAuthentication(byte[] userName, byte[] password) throws NullPointerException { name = userName; pass = password; diff --git a/src/javax/obex/ServerRequestHandler.java b/src/javax/obex/ServerRequestHandler.java index 4bc645051..dd4eefbec 100644 --- a/src/javax/obex/ServerRequestHandler.java +++ b/src/javax/obex/ServerRequestHandler.java @@ -29,19 +29,15 @@ public void setConnectionID(long id) throws IllegalArgumentException { } public long getConnectionID() { return this.connectionID; } - public int onConnect(HeaderSet request, HeaderSet reply) - { return ResponseCodes.OBEX_HTTP_OK; } + public int onConnect(HeaderSet request, HeaderSet reply) { return ResponseCodes.OBEX_HTTP_OK; } public void onDisconnect(HeaderSet request, HeaderSet reply) { } - public int onSetPath(HeaderSet request, HeaderSet reply, boolean backup, - boolean create) { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + public int onSetPath(HeaderSet request, HeaderSet reply, boolean backup, boolean create) { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } - public int onDelete(HeaderSet request, HeaderSet reply) - { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + public int onDelete(HeaderSet request, HeaderSet reply) { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } - public int onPut(Operation op) - { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } + public int onPut(Operation op) { return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED; } public void onAuthenticationFailure(byte[] userName) { } diff --git a/src/javax/obex/SessionNotifier.java b/src/javax/obex/SessionNotifier.java index cb5cdd2f6..dd365a9b1 100644 --- a/src/javax/obex/SessionNotifier.java +++ b/src/javax/obex/SessionNotifier.java @@ -23,10 +23,8 @@ public interface SessionNotifier extends Connection { - Connection acceptAndOpen(ServerRequestHandler handler) throws IOException, - NullPointerException; + Connection acceptAndOpen(ServerRequestHandler handler) throws IOException, NullPointerException; - Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth) - throws IOException, NullPointerException; + Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth) throws IOException, NullPointerException; } From 2f6ca2c4bcd62ede79ed1730331d31b17be396a6 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Tue, 14 Jun 2022 20:09:45 -0300 Subject: [PATCH 14/23] javax: bluetooth: Clean up LocalDevice and implement UUID The UUID implementation might still be incorrect, i'm basing it almost entirely on the data from the docs. --- src/javax/bluetooth/LocalDevice.java | 14 +++--- src/javax/bluetooth/UUID.java | 75 ++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/javax/bluetooth/LocalDevice.java b/src/javax/bluetooth/LocalDevice.java index 4634ed754..ee47a464d 100644 --- a/src/javax/bluetooth/LocalDevice.java +++ b/src/javax/bluetooth/LocalDevice.java @@ -35,7 +35,8 @@ public class LocalDevice private static Hashtable properties = new Hashtable(); - static { + static + { /* We won't have functional Bluetooth yet */ properties.put("bluetooth.api.version", "0.0"); properties.put("bluetooth.master.switch", "false"); properties.put("bluetooth.sd.attr.retrievable.max", "0"); @@ -62,15 +63,12 @@ public class LocalDevice public static String getProperty(String property) { return properties.get(property); } - public static ServiceRecord getRecord(Connection notifier) throws IllegalArgumentException, - NullPointerException { return srvcRcd; } + public static ServiceRecord getRecord(Connection notifier) throws IllegalArgumentException, NullPointerException { return srvcRcd; } - public static boolean isPowerOn() { return false; } /* We won't have functional Bluetooth yet */ + public static boolean isPowerOn() { return false; } - public static boolean setDiscoverable(int mode) throws IllegalArgumentException, - BluetoothStateException { return false; } + public static boolean setDiscoverable(int mode) throws IllegalArgumentException, BluetoothStateException { return false; } - public static void updateRecord(ServiceRecord srvRecord) throws NullPointerException, - IllegalArgumentException, ServiceRegistrationException { } + public static void updateRecord(ServiceRecord srvRecord) throws NullPointerException, IllegalArgumentException, ServiceRegistrationException { } } diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 8e5c77187..3407bf7a2 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -20,19 +20,76 @@ public class UUID { - UUID uuid; - private static final String BASE_UUID_VALUE = "0x0000000000001000800000805F9B34FB"; + private final long baseUUID1 = 0x00000000; + + private final long baseUUID2 = 0x00001000; + + private final long baseUUID3 = 0x80000080; + + private final long baseUUID4 = 0x5F9B34FB; + + private final long UUID1, UUID2, UUID3, UUID4; + + public UUID(long uuidValue) throws IllegalArgumentException + { + if (uuidValue < 0L || uuidValue > 0xffffffffL) { throw new IllegalArgumentException("Invalid UUID Value, must be between 0 an (2^32)-1"); } + else + { + UUID1 = baseUUID1; + UUID2 = baseUUID2; + UUID3 = baseUUID3; + UUID4 = uuidValue; + } + } - public UUID(long uuidValue) throws IllegalArgumentException { System.out.println("UUID Value:" + uuidValue); } + public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException, NullPointerException, NumberFormatException + { + if (uuidValue == null) { throw new NullPointerException("Received a NULL UUID string."); } - public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException, NullPointerException, - NumberFormatException { System.out.println("UUID Value:" + uuidValue); } + if (uuidValue.length() == 0) { throw new IllegalArgumentException("Received an empty UUID string."); } + + if (shortUUID) + { + if(uuidValue.length() > 8) { throw new IllegalArgumentException("UUID string is too long for a shortUUID"); } + else + { + String formattedUuidValue = String.format("%08d", uuidValue); + UUID1 = baseUUID1; + UUID2 = baseUUID2; + UUID3 = baseUUID3; + UUID4 = Long.parseUnsignedLong(formattedUuidValue, 16); + } + } + else + { + if(uuidValue.length() > 32) { throw new IllegalArgumentException("UUID value is too long"); } + else + { + String formattedUuidValue = String.format("%032d", uuidValue); + UUID1 = Long.parseUnsignedLong(formattedUuidValue.substring(0, 8), 16); + UUID2 = Long.parseUnsignedLong(formattedUuidValue.substring(8, 16), 16); + UUID3 = Long.parseUnsignedLong(formattedUuidValue.substring(16, 24), 16); + UUID4 = Long.parseUnsignedLong(formattedUuidValue.substring(24, 32), 16); + } + } + } - public boolean equals(Object value) { return false; } + @Override + public boolean equals(Object value) + { + if (value == null || (value instanceof UUID) == false) { return false; } + + return this.equals(value); + } - public int hashCode() { return uuid.hashCode(); } + @Override + public int hashCode() { return this.hashCode(); } - public String toString() { return BASE_UUID_VALUE; } + @Override + public String toString() + { + String uuidString = Long.toHexString(UUID1) + Long.toHexString(UUID2) + Long.toHexString(UUID3) + Long.toHexString(UUID4); + return uuidString.toUpperCase().replaceFirst("^0+(?!$)", ""); + } } - \ No newline at end of file From 4e0cab93b44545a8b122cffc0c843d6f03a8b3c0 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Tue, 21 Jun 2022 23:25:36 -0300 Subject: [PATCH 15/23] Revert "Truncate record IDs to 0 in some cases." Instead of checking and working around cases where the rms index would be lower than zero, it's better to simply find a way to make sure it won't ever go below zero at all. This reverts commit 3ee6a3c40ae549c5b6ca5d212b0d4fbcc422d8a1. --- src/javax/microedition/rms/RecordStore.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/javax/microedition/rms/RecordStore.java b/src/javax/microedition/rms/RecordStore.java index 267fea24f..ff9fccd2d 100644 --- a/src/javax/microedition/rms/RecordStore.java +++ b/src/javax/microedition/rms/RecordStore.java @@ -548,7 +548,6 @@ public int nextRecordId() throws InvalidRecordIDException //System.out.println("> Next Record ID (idx:"+index+" cnt:"+count+")"); if(keepupdated) { rebuild(); } if(index>=count) { throw(new InvalidRecordIDException()); } - if(index < 0) return elements[0]; // If an invalid index is received, truncate it to 0. return elements[index]; } From 08f6a91c233a2493f44c98cc67f6c867c4f0b7ce Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Tue, 28 Jun 2022 13:03:21 -0300 Subject: [PATCH 16/23] javax: bluetooth: UUID: Fix some uuid conversion problems. --- src/javax/bluetooth/UUID.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 3407bf7a2..d5080cfa9 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -20,13 +20,13 @@ public class UUID { - private final long baseUUID1 = 0x00000000; + private final long baseUUID1 = 0x0000_0000L; - private final long baseUUID2 = 0x00001000; + private final long baseUUID2 = 0x0000_1000L; - private final long baseUUID3 = 0x80000080; + private final long baseUUID3 = 0x8000_0080L; - private final long baseUUID4 = 0x5F9B34FB; + private final long baseUUID4 = 0x5F9B_34FBL; private final long UUID1, UUID2, UUID3, UUID4; @@ -88,8 +88,8 @@ public boolean equals(Object value) @Override public String toString() { - String uuidString = Long.toHexString(UUID1) + Long.toHexString(UUID2) + Long.toHexString(UUID3) + Long.toHexString(UUID4); - return uuidString.toUpperCase().replaceFirst("^0+(?!$)", ""); + String uuidString = String.format("%08X", UUID1) + String.format("%08X", UUID2) + String.format("%08X", UUID3) + String.format("%08X", UUID4); + return uuidString.replaceFirst("^0+", ""); } } From c40e573244ebb6bd1bf456debd07a711ba58e8ba Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 29 Jun 2022 11:30:12 -0300 Subject: [PATCH 17/23] javax: bluetooth: UUID: Improve the code with a few ideas. @recompileorg had some suggestions in the form of code, and a few of the implementations could be ported over to this current one. --- src/javax/bluetooth/UUID.java | 67 +++++++++++++++-------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index d5080cfa9..7c9d6cd06 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -20,57 +20,47 @@ public class UUID { - private final long baseUUID1 = 0x0000_0000L; - - private final long baseUUID2 = 0x0000_1000L; - - private final long baseUUID3 = 0x8000_0080L; - - private final long baseUUID4 = 0x5F9B_34FBL; + private final long[] baseUUID = { 0x0000_0000L, 0x0000_1000L, 0x8000_0080L, 0x5F9B_34FBL }; + + private final long[] UUIDval = { 0x0000_0000L, 0x0000_0000L, 0x0000_0000L, 0x0000_0000L }; - private final long UUID1, UUID2, UUID3, UUID4; public UUID(long uuidValue) throws IllegalArgumentException { if (uuidValue < 0L || uuidValue > 0xffffffffL) { throw new IllegalArgumentException("Invalid UUID Value, must be between 0 an (2^32)-1"); } else { - UUID1 = baseUUID1; - UUID2 = baseUUID2; - UUID3 = baseUUID3; - UUID4 = uuidValue; + UUIDval[0] = uuidValue; + UUIDval[1] = baseUUID[1]; + UUIDval[2] = baseUUID[2]; + UUIDval[3] = baseUUID[3]; } } public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException, NullPointerException, NumberFormatException - { - if (uuidValue == null) { throw new NullPointerException("Received a NULL UUID string."); } + { + int length = uuidValue.length(); + + if(uuidValue == null || length==0 || length>32 || (shortUUID && length>8) ) + { + throw new IllegalArgumentException("Received an invalid UUID String. Check it's size and type."); + } - if (uuidValue.length() == 0) { throw new IllegalArgumentException("Received an empty UUID string."); } - if (shortUUID) { - if(uuidValue.length() > 8) { throw new IllegalArgumentException("UUID string is too long for a shortUUID"); } - else - { - String formattedUuidValue = String.format("%08d", uuidValue); - UUID1 = baseUUID1; - UUID2 = baseUUID2; - UUID3 = baseUUID3; - UUID4 = Long.parseUnsignedLong(formattedUuidValue, 16); - } + String formattedUuidValue = String.format("%08X", uuidValue); + UUIDval[0] = Long.parseUnsignedLong(formattedUuidValue, 16); + UUIDval[1] = baseUUID[1]; + UUIDval[2] = baseUUID[2]; + UUIDval[3] = baseUUID[3]; } else { - if(uuidValue.length() > 32) { throw new IllegalArgumentException("UUID value is too long"); } - else - { - String formattedUuidValue = String.format("%032d", uuidValue); - UUID1 = Long.parseUnsignedLong(formattedUuidValue.substring(0, 8), 16); - UUID2 = Long.parseUnsignedLong(formattedUuidValue.substring(8, 16), 16); - UUID3 = Long.parseUnsignedLong(formattedUuidValue.substring(16, 24), 16); - UUID4 = Long.parseUnsignedLong(formattedUuidValue.substring(24, 32), 16); - } + String formattedUuidValue = String.format("%032X", uuidValue); + UUIDval[0] = Long.parseUnsignedLong(formattedUuidValue.substring(0, 8), 16); + UUIDval[1] = Long.parseUnsignedLong(formattedUuidValue.substring(8, 16), 16); + UUIDval[2] = Long.parseUnsignedLong(formattedUuidValue.substring(16, 24), 16); + UUIDval[3] = Long.parseUnsignedLong(formattedUuidValue.substring(24, 32), 16); } } @@ -78,18 +68,17 @@ public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException public boolean equals(Object value) { if (value == null || (value instanceof UUID) == false) { return false; } - - return this.equals(value); + + return ((UUID)value).toString().equals(this.toString()); } @Override - public int hashCode() { return this.hashCode(); } + public int hashCode() { return (int)(UUIDval[0] & 0xFFFFFFFF); } @Override public String toString() { - String uuidString = String.format("%08X", UUID1) + String.format("%08X", UUID2) + String.format("%08X", UUID3) + String.format("%08X", UUID4); + String uuidString = String.format("%08X", UUIDval[0]) + String.format("%08X", UUIDval[1]) + String.format("%08X", UUIDval[2]) + String.format("%08X", UUIDval[3]); return uuidString.replaceFirst("^0+", ""); } - } From bcd09cc3c5a2766d5cbd44b33413d63e9519fe1f Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 29 Jun 2022 11:35:33 -0300 Subject: [PATCH 18/23] javax: bluetooth: UUID: Fixing a small typo. --- src/javax/bluetooth/UUID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 7c9d6cd06..8fae2d1c0 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -43,7 +43,7 @@ public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException if(uuidValue == null || length==0 || length>32 || (shortUUID && length>8) ) { - throw new IllegalArgumentException("Received an invalid UUID String. Check it's size and type."); + throw new IllegalArgumentException("Received an invalid UUID String. Check its size and type."); } if (shortUUID) From 25da7820ee25487cf661e80102483e5dab81db97 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 29 Jun 2022 11:39:22 -0300 Subject: [PATCH 19/23] javax: bluetooth: UUID: Clearing an empty line at the start. No idea how that empty first line escaped my sight for so long... Should be formatted correctly now. --- src/javax/bluetooth/UUID.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 8fae2d1c0..4b660d0fd 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -1,4 +1,3 @@ - /* This file is part of FreeJ2ME. From 805b0737a8a8b8e2f362096b4dce4eef9806cf87 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 29 Jun 2022 17:51:18 -0300 Subject: [PATCH 20/23] Revert "freej2me: libretro: Make the pointer position calc more readable." This reverts commit 0522ab439946cdc1e95699ab4a06a40112198536. --- src/org/recompile/freej2me/Libretro.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/recompile/freej2me/Libretro.java b/src/org/recompile/freej2me/Libretro.java index bf52bde76..29270ca05 100644 --- a/src/org/recompile/freej2me/Libretro.java +++ b/src/org/recompile/freej2me/Libretro.java @@ -185,7 +185,7 @@ public void run() } else { - Mobile.getPlatform().pointerReleased(lcdWidth-mousey, mousex); + Mobile.getPlatform().pointerReleased(-mousey+lcdWidth, mousex); } break; @@ -198,7 +198,7 @@ public void run() } else { - Mobile.getPlatform().pointerPressed(lcdWidth-mousey, mousex); + Mobile.getPlatform().pointerPressed(-mousey+lcdWidth, mousex); } break; @@ -211,7 +211,7 @@ public void run() } else { - Mobile.getPlatform().pointerDragged(lcdWidth-mousey, mousex); + Mobile.getPlatform().pointerDragged(-mousey+lcdWidth, mousex); } break; From 5dda662760489ecbec5461f5d33821ddf8898b3b Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Wed, 29 Jun 2022 17:51:45 -0300 Subject: [PATCH 21/23] Revert "freej2me-lr: Fix rotated pointer coordinates." This reverts commit 35cb096b2c95b783347aac0e71824256b503750a. --- src/org/recompile/freej2me/Libretro.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/recompile/freej2me/Libretro.java b/src/org/recompile/freej2me/Libretro.java index 29270ca05..09dba5503 100644 --- a/src/org/recompile/freej2me/Libretro.java +++ b/src/org/recompile/freej2me/Libretro.java @@ -185,7 +185,7 @@ public void run() } else { - Mobile.getPlatform().pointerReleased(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerReleased(mousey, mousex); } break; @@ -198,7 +198,7 @@ public void run() } else { - Mobile.getPlatform().pointerPressed(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerPressed(mousey, mousex); } break; @@ -211,7 +211,7 @@ public void run() } else { - Mobile.getPlatform().pointerDragged(-mousey+lcdWidth, mousex); + Mobile.getPlatform().pointerDragged(mousey, mousex); } break; From 83fe551f743557ab664b54671a726077c6fe9772 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Thu, 30 Jun 2022 10:39:51 -0300 Subject: [PATCH 22/23] javax: bluetooth: UUID: Fixing one of the UUID constructors. --- src/javax/bluetooth/UUID.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 4b660d0fd..0be3e460e 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -37,17 +37,17 @@ public UUID(long uuidValue) throws IllegalArgumentException } public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException, NullPointerException, NumberFormatException - { + { int length = uuidValue.length(); - if(uuidValue == null || length==0 || length>32 || (shortUUID && length>8) ) + if(length == 0 || length > 32 || (shortUUID && length > 8) ) { - throw new IllegalArgumentException("Received an invalid UUID String. Check its size and type."); + throw new IllegalArgumentException("Received an UUID with invalid length."); } if (shortUUID) { - String formattedUuidValue = String.format("%08X", uuidValue); + String formattedUuidValue = String.format("%1$" + 8 + "s", uuidValue).replace(' ', '0'); UUIDval[0] = Long.parseUnsignedLong(formattedUuidValue, 16); UUIDval[1] = baseUUID[1]; UUIDval[2] = baseUUID[2]; @@ -55,7 +55,7 @@ public UUID(String uuidValue, boolean shortUUID) throws IllegalArgumentException } else { - String formattedUuidValue = String.format("%032X", uuidValue); + String formattedUuidValue = String.format("%1$" + 32 + "s", uuidValue).replace(' ', '0'); UUIDval[0] = Long.parseUnsignedLong(formattedUuidValue.substring(0, 8), 16); UUIDval[1] = Long.parseUnsignedLong(formattedUuidValue.substring(8, 16), 16); UUIDval[2] = Long.parseUnsignedLong(formattedUuidValue.substring(16, 24), 16); From 929af842350509c351f0a4ad3258c66d09e93372 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Fri, 1 Jul 2022 10:59:03 -0300 Subject: [PATCH 23/23] javax: bluetooth: UUID: Adjusting the UUID variables' types. --- src/javax/bluetooth/UUID.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/javax/bluetooth/UUID.java b/src/javax/bluetooth/UUID.java index 0be3e460e..59ab11025 100644 --- a/src/javax/bluetooth/UUID.java +++ b/src/javax/bluetooth/UUID.java @@ -19,9 +19,9 @@ public class UUID { - private final long[] baseUUID = { 0x0000_0000L, 0x0000_1000L, 0x8000_0080L, 0x5F9B_34FBL }; + private static final long[] baseUUID = { 0x0000_0000L, 0x0000_1000L, 0x8000_0080L, 0x5F9B_34FBL }; - private final long[] UUIDval = { 0x0000_0000L, 0x0000_0000L, 0x0000_0000L, 0x0000_0000L }; + private long[] UUIDval = { 0x0000_0000L, 0x0000_0000L, 0x0000_0000L, 0x0000_0000L }; public UUID(long uuidValue) throws IllegalArgumentException