Skip to content

Commit 3e27d59

Browse files
committed
doc: java links
1 parent 951197b commit 3e27d59

File tree

14 files changed

+31
-20
lines changed

14 files changed

+31
-20
lines changed

+stdlib/+fileio/absolute_path.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function abspath = absolute_path(p)
2-
2+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.html#getAbsolutePath()
33
arguments
44
p string {mustBeScalarOrEmpty}
55
end

+stdlib/+fileio/canonical.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function c = canonical(p)
2-
2+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.html#getCanonicalPath()
33
arguments
44
p string {mustBeScalarOrEmpty}
55
end
@@ -32,8 +32,6 @@
3232
% REQUIRES path to exist, while java method does not.
3333
% c = builtin('_canonicalizepath', c);
3434

35-
% https://docs.oracle.com/javase/9/docs/api/java/io/File.html#getCanonicalPath--
36-
3735
c = stdlib.fileio.posix(string(java.io.File(c).getCanonicalPath()));
3836

3937
end % function

+stdlib/+fileio/file_checksum.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
%
55
% method: "MD5", "SHA-1", "SHA-256", etc.
66
%
7-
% Reference: https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html
7+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/security/MessageDigest.html#getInstance(java.lang.String)
88
arguments
9-
file (1,1) string {mustBeFile}
10-
method (1,1) string {mustBeNonzeroLengthText}
9+
file (1,1) string {mustBeFile}
10+
method (1,1) string {mustBeNonzeroLengthText}
1111
end
1212

1313
if any(method == ["sha256", "SHA256"])
@@ -22,10 +22,12 @@
2222
assert(fid > 0, "could not open " + file)
2323

2424
while ~feof(fid)
25+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/security/MessageDigest.html#update(byte)
2526
inst.update(fread(fid, file_chunk, '*uint8'))
2627
end
2728
fclose(fid);
2829

30+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/security/MessageDigest.html#digest()
2931
hash = typecast(inst.digest, 'uint8');
3032

3133
hash = string(sprintf('%.2x', hash));

+stdlib/+fileio/homedir.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function home = homedir()
2-
2+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/System.html#getProperty(java.lang.String)
3+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/System.html#getProperties()
34
persistent h;
45

56
if ~isempty(h)

+stdlib/+fileio/is_absolute_path.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function isabs = is_absolute_path(apath)
2-
2+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.html#isAbsolute()
33
arguments
44
apath string {mustBeScalarOrEmpty}
55
end

+stdlib/+fileio/is_exe.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
function ok = is_exe(file)
2+
%% is_exe is file executable
3+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.html#canExecute()
24

35
arguments
46
file string {mustBeScalarOrEmpty}

+stdlib/+fileio/normalize.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function n = normalize(p)
22
% normalize(p) remove redundant elements of path p
3+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Path.html#normalize()
34
arguments
45
p string {mustBeScalarOrEmpty}
56
end
@@ -9,7 +10,6 @@
910
return
1011
end
1112

12-
n = stdlib.fileio.posix(string(...
13-
java.io.File(stdlib.fileio.expanduser(n)).toPath().normalize()));
13+
n = stdlib.fileio.posix(java.io.File(stdlib.fileio.expanduser(n)).toPath().normalize());
1414

1515
end

+stdlib/+fileio/resolve.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
% REQUIRES path to exist, while java method does not.
2727
% c = builtin('_canonicalizepath', c);
2828

29-
% https://docs.oracle.com/javase/9/docs/api/java/io/File.html#getCanonicalPath--
29+
% % https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.html#getCanonicalPath()
3030

3131
c = stdlib.fileio.posix(string(java.io.File(c).getCanonicalPath()));
3232

+stdlib/+fileio/samepath.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function issame = samepath(path1, path2)
2-
2+
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Files.html#isSameFile(java.nio.file.Path,java.nio.file.Path)
33
arguments
44
path1 string {mustBeScalarOrEmpty}
55
path2 string {mustBeScalarOrEmpty}

+stdlib/+sys/cpu_load.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
function L = cpu_load()
22
%% CPU_LOAD get total physical CPU load
3-
% https://docs.oracle.com/javase/9/docs/api/com/sun/management/OperatingSystemMXBean.html#getSystemCpuLoad--
3+
% https://docs.oracle.com/en/java/javase/21/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getCpuLoad()
44
% Returns the "recent cpu usage" for the whole system.
55
% This value is a double in the [0.0,1.0] interval.
66
% A value of 0.0 means that all CPUs were idle during the recent period of time observed, while a value of 1.0 means that all CPUs were actively running 100% of the time during the recent period being observed.
77
% All values betweens 0.0 and 1.0 are possible depending of the activities going on in the system.
88
% If the system recent cpu usage is not available, the method returns a negative value.
99

1010
b = java.lang.management.ManagementFactory.getOperatingSystemMXBean();
11-
L = b.getSystemCpuLoad();
11+
12+
L = b.getSystemCpuLoad(); % deprecated, but Matlab R2023b didn't have getCpuLoad() yet
1213

1314
end

0 commit comments

Comments
 (0)