system.io.Path Maven / Gradle / Ivy
/*
* MIT License
*
* Copyright (c) 2024 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
*
* This code was generated from a template using JCOReflector v. 1.14.0.0
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
*
*************************************************************************************/
package system.io;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
/**
* The base .NET class managing System.IO.Path, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
*
*
* .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.IO.Path
*
*
* Powered by JCOBridge: more info at https://www.jcobridge.com
*
* @author MASES s.r.l https://masesgroup.com
* @version 1.14.0.0
*/
public class Path extends NetObject {
/**
* Fully assembly qualified name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: mscorlib
*/
public static final String assemblyShortName = "mscorlib";
/**
* Qualified class name: System.IO.Path
*/
public static final String className = "System.IO.Path";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
String classToCreate = className + ", "
+ (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Creating %s", classToCreate);
JCType typeCreated = bridge.GetType(classToCreate);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Created: %s",
(typeCreated != null) ? typeCreated.toString() : "Returned null value");
return typeCreated;
} catch (JCException e) {
JCOReflector.writeLog(e);
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
/**
* Internal constructor. Use with caution
*/
public Path(java.lang.Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public java.lang.Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link Path}, a cast assert is made to check if types are compatible.
* @param from {@link IJCOBridgeReflected} instance to be casted
* @return {@link Path} instance
* @throws java.lang.Throwable in case of error during cast operation
*/
public static Path cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new Path(from.getJCOInstance());
}
// Constructors section
public Path() throws Throwable {
}
// Methods section
public static boolean HasExtension(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (boolean)classType.Invoke("HasExtension", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static boolean IsPathRooted(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (boolean)classType.Invoke("IsPathRooted", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static char[] GetInvalidFileNameChars() throws Throwable {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classType.Invoke("GetInvalidFileNameChars");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
char[] resultingArray = new char[resultingArrayList.size()];
for(int indexGetInvalidFileNameChars = 0; indexGetInvalidFileNameChars < resultingArrayList.size(); indexGetInvalidFileNameChars++ ) {
resultingArray[indexGetInvalidFileNameChars] = (char)resultingArrayList.get(indexGetInvalidFileNameChars);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static char[] GetInvalidPathChars() throws Throwable {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classType.Invoke("GetInvalidPathChars");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
char[] resultingArray = new char[resultingArrayList.size()];
for(int indexGetInvalidPathChars = 0; indexGetInvalidPathChars < resultingArrayList.size(); indexGetInvalidPathChars++ ) {
resultingArray[indexGetInvalidPathChars] = (char)resultingArrayList.get(indexGetInvalidPathChars);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String ChangeExtension(java.lang.String path, java.lang.String extension) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("ChangeExtension", path, extension);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String Combine(java.lang.String path1, java.lang.String path2) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("Combine", path1, path2);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String Combine(java.lang.String path1, java.lang.String path2, java.lang.String path3) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("Combine", path1, path2, path3);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String Combine(java.lang.String path1, java.lang.String path2, java.lang.String path3, java.lang.String path4) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("Combine", path1, path2, path3, path4);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String Combine(java.lang.String... paths) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.OutOfMemoryException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("Combine", (java.lang.Object)paths);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String Combine(JCORefOut dupParam0) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.OutOfMemoryException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("Combine", (java.lang.Object)dupParam0.getJCRefOut());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetDirectoryName(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.io.PathTooLongException, system.OutOfMemoryException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.NotSupportedException, system.io.FileNotFoundException, system.io.DirectoryNotFoundException, system.UnauthorizedAccessException, system.io.IOException, system.io.DriveNotFoundException, system.OperationCanceledException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetDirectoryName", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetExtension(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetExtension", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetFileName(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetFileName", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetFileNameWithoutExtension(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetFileNameWithoutExtension", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetFullPath(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.io.PathTooLongException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.io.FileNotFoundException, system.io.DirectoryNotFoundException, system.UnauthorizedAccessException, system.io.IOException, system.io.DriveNotFoundException, system.OperationCanceledException, system.NotSupportedException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetFullPath", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetPathRoot(java.lang.String path) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.io.PathTooLongException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.NotSupportedException, system.io.FileNotFoundException, system.io.DirectoryNotFoundException, system.UnauthorizedAccessException, system.io.IOException, system.io.DriveNotFoundException, system.OperationCanceledException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetPathRoot", path);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetRandomFileName() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.OutOfMemoryException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetRandomFileName");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetTempFileName() throws Throwable, system.ArgumentException, system.ArgumentNullException, system.FormatException, system.ArgumentOutOfRangeException, system.NotSupportedException, system.io.FileNotFoundException, system.io.DirectoryNotFoundException, system.UnauthorizedAccessException, system.io.IOException, system.io.PathTooLongException, system.io.DriveNotFoundException, system.OperationCanceledException, system.IndexOutOfRangeException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetTempFileName");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static java.lang.String GetTempPath() throws Throwable, system.ArgumentException, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.FormatException, system.NotSupportedException, system.io.FileNotFoundException, system.io.DirectoryNotFoundException, system.UnauthorizedAccessException, system.io.IOException, system.io.PathTooLongException, system.io.DriveNotFoundException, system.OperationCanceledException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
return (java.lang.String)classType.Invoke("GetTempPath");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Properties section
// Instance Events section
}