system.net.sockets.SocketAsyncEventArgs 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.net.sockets;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.EventArgs;
import system.net.EndPoint;
import system.net.sockets.IPPacketInformation;
import system.net.sockets.SendPacketsElement;
import system.net.sockets.Socket;
import system.net.sockets.SocketAsyncOperation;
import system.net.sockets.SocketClientAccessPolicyProtocol;
import system.net.sockets.SocketError;
import system.net.sockets.SocketFlags;
import system.net.sockets.TransmitFileOptions;
/**
* The base .NET class managing System.Net.Sockets.SocketAsyncEventArgs, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
*
*
* .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.Net.Sockets.SocketAsyncEventArgs
*
*
* 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 SocketAsyncEventArgs extends EventArgs implements AutoCloseable {
/**
* Fully assembly qualified name: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: System
*/
public static final String assemblyShortName = "System";
/**
* Qualified class name: System.Net.Sockets.SocketAsyncEventArgs
*/
public static final String className = "System.Net.Sockets.SocketAsyncEventArgs";
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 SocketAsyncEventArgs(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 SocketAsyncEventArgs}, a cast assert is made to check if types are compatible.
* @param from {@link IJCOBridgeReflected} instance to be casted
* @return {@link SocketAsyncEventArgs} instance
* @throws java.lang.Throwable in case of error during cast operation
*/
public static SocketAsyncEventArgs cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new SocketAsyncEventArgs(from.getJCOInstance());
}
// Constructors section
public SocketAsyncEventArgs() throws Throwable {
try {
// add reference to assemblyName.dll file
addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Methods section
public void Dispose() throws Throwable, system.ArgumentException, system.ArgumentNullException, system.collections.generic.KeyNotFoundException, system.InvalidOperationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Dispose");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void SetBuffer(byte[] buffer, int offset, int count) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.collections.generic.KeyNotFoundException, system.OutOfMemoryException, system.net.sockets.SocketException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("SetBuffer", buffer, offset, count);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void SetBuffer(JCORefOut dupParam0, int dupParam1, int dupParam2) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.collections.generic.KeyNotFoundException, system.OutOfMemoryException, system.net.sockets.SocketException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("SetBuffer", dupParam0.getJCRefOut(), dupParam1, dupParam2);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void SetBuffer(int offset, int count) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.collections.generic.KeyNotFoundException, system.OutOfMemoryException, system.net.sockets.SocketException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("SetBuffer", offset, count);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void close() throws Exception {
try {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Dispose");
}
catch (JCNativeException jcne) {
throw translateException(jcne);
}
} catch (Throwable t) {
throw new Exception(t);
}
}
// Properties section
public boolean getDisconnectReuseSocket() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("DisconnectReuseSocket");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setDisconnectReuseSocket(boolean DisconnectReuseSocket) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("DisconnectReuseSocket", DisconnectReuseSocket);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public byte[] getBuffer() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Get("Buffer");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
byte[] resultingArray = new byte[resultingArrayList.size()];
for(int indexBuffer = 0; indexBuffer < resultingArrayList.size(); indexBuffer++ ) {
resultingArray[indexBuffer] = (byte)resultingArrayList.get(indexBuffer);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getBytesTransferred() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("BytesTransferred");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getCount() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("Count");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getOffset() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("Offset");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getSendPacketsSendSize() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("SendPacketsSendSize");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSendPacketsSendSize(int SendPacketsSendSize) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SendPacketsSendSize", SendPacketsSendSize);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetException getConnectByNameError() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("ConnectByNameError");
return new NetException(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public EndPoint getRemoteEndPoint() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("RemoteEndPoint");
return new EndPoint(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setRemoteEndPoint(EndPoint RemoteEndPoint) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("RemoteEndPoint", RemoteEndPoint == null ? null : RemoteEndPoint.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IPPacketInformation getReceiveMessageFromPacketInfo() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("ReceiveMessageFromPacketInfo");
return new IPPacketInformation(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public final SendPacketsElement[] getSendPacketsElements() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Get("SendPacketsElements");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new SendPacketsElement(resultingObject));
}
SendPacketsElement[] resultingArray = new SendPacketsElement[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSendPacketsElements(SendPacketsElement[] SendPacketsElements) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.collections.generic.KeyNotFoundException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SendPacketsElements", toObjectFromArray(SendPacketsElements));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public Socket getAcceptSocket() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("AcceptSocket");
return new Socket(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setAcceptSocket(Socket AcceptSocket) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("AcceptSocket", AcceptSocket == null ? null : AcceptSocket.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public Socket getConnectSocket() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("ConnectSocket");
return new Socket(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public SocketAsyncOperation getLastOperation() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("LastOperation");
return new SocketAsyncOperation(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public SocketClientAccessPolicyProtocol getSocketClientAccessPolicyProtocol() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("SocketClientAccessPolicyProtocol");
return new SocketClientAccessPolicyProtocol(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSocketClientAccessPolicyProtocol(SocketClientAccessPolicyProtocol SocketClientAccessPolicyProtocol) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SocketClientAccessPolicyProtocol", SocketClientAccessPolicyProtocol == null ? null : SocketClientAccessPolicyProtocol.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public SocketError getSocketError() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("SocketError");
return new SocketError(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSocketError(SocketError SocketError) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SocketError", SocketError == null ? null : SocketError.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public SocketFlags getSocketFlags() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("SocketFlags");
return new SocketFlags(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSocketFlags(SocketFlags SocketFlags) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SocketFlags", SocketFlags == null ? null : SocketFlags.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public TransmitFileOptions getSendPacketsFlags() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("SendPacketsFlags");
return new TransmitFileOptions(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setSendPacketsFlags(TransmitFileOptions SendPacketsFlags) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("SendPacketsFlags", SendPacketsFlags == null ? null : SendPacketsFlags.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject getUserToken() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("UserToken");
return new NetObject(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setUserToken(NetObject UserToken) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("UserToken", UserToken == null ? null : UserToken.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
}