vs
Class ByDesc

java.lang.Object
  extended byvs.VMSparam
      extended byvs.ByDesc

public class ByDesc
extends VMSparam

Used to pass a parameter by descriptor. This is equivalent to similar constructs in other languages, such as:

PL/I sts$value = lib$out_output(descriptor('hello world'));
BASIC call lib$put_output("hello, world!" by desc)
C $DESCRIPTOR(str, "hello, world!");

lib$put_output(&str);

The following Java code performs the same operation:

 lib.lib$put_output(new VMSparam[] {
                        new ByDesc("hello, world!");
                    });
 

See Also:
ByRef, ByVal

Constructor Summary
ByDesc(java.lang.Byte b)
          Pass a Byte object by descriptor.
ByDesc(byte[] b)
          Pass a byte array by descriptor.
ByDesc(Cmem b)
          Pass a Cmem object by descriptor.
ByDesc(int[] b)
          Pass an array of int by descriptor.
ByDesc(java.lang.Integer b)
          Pass an Integer object by descriptor.
ByDesc(java.lang.Long b)
          Pass a Long object by descriptor.
ByDesc(long[] b)
          Pass an array of long by descriptor.
ByDesc(java.lang.Short b)
          Pass a Short object by descriptor.
ByDesc(short[] b)
          Pass an array of short by descriptor.
ByDesc(java.lang.String b)
          Pass a String by descriptor.
ByDesc(java.lang.StringBuffer s)
          Pass a StringBuffer by descriptor.
ByDesc(VmsStruct s)
          Pass a VmsStruct by descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByDesc

public ByDesc(VmsStruct s)
Pass a VmsStruct by descriptor.

This is simply a convenience method that is equivalent to the following Java code snippet.

 new ByDesc(s.getTarget())
 

Parameters:
s - VmsStruct to pass by descriptor.

ByDesc

public ByDesc(java.lang.StringBuffer s)
Pass a StringBuffer by descriptor.

This constructor is different to all other ByDesc constructors in that it will pass the StringBuffer by dynamic string descriptor. It can be used to receive a string argument in the case of this example:

 import vs.*;
 import vs.starlet.*;
 import vs.starlet.STS;

 public class GetInput
 {
     public static final void main(String[] args)
     {
         StringBuffer buffer = new StringBuffer();

         sstatus = lib$get_input.call(new VMSparam[] {
                                          new ByDesc(buffer),
                                          new ByDesc(">>")
                                      });
         if (!STS.$VMS_STATUS_SUCCESS(sstatus))
             System.out.println("There was an error during input");
         else
             System.out.println("The following was read: " + buffer.toString());
     }
 }
 

Don't forget that this can also be used for arguments that accept only static string descriptors, like $FAO. It is just necessary to pre-load the string to ensure enough storage is available. This is the same as the requirement for BASIC and the purpose of the SPACE$ builtin function.

Parameters:
s - StringBuffer to be passed by dynamic descriptor.

ByDesc

public ByDesc(byte[] b)
Pass a byte array by descriptor.

Parameters:
b - byte array to be passed by descriptor.

ByDesc

public ByDesc(java.lang.String b)
Pass a String by descriptor. This is simply a convenience method that performs the equivalent of:

ByDesc("hello, world!".getBytes());

Be careful when using this method. It cannot be used to return any data. The above code snippet creates a new byte array which is passed to the routine. There is no way or returning a reference to this storage.

Parameters:
b - String value to be passed by descriptor.

ByDesc

public ByDesc(int[] b)
Pass an array of int by descriptor.

Parameters:
b - int array to be passed by descriptor.

ByDesc

public ByDesc(short[] b)
Pass an array of short by descriptor.

Parameters:
b - short array to be passed by descriptor.

ByDesc

public ByDesc(long[] b)
Pass an array of long by descriptor.

Parameters:
b - long array to be passed by descriptor.

ByDesc

public ByDesc(java.lang.Long b)
Pass a Long object by descriptor.

Parameters:
b - Long object to be passed by descriptor.

ByDesc

public ByDesc(java.lang.Integer b)
Pass an Integer object by descriptor.

Parameters:
b - Integer object to be passed by descriptor.

ByDesc

public ByDesc(java.lang.Short b)
Pass a Short object by descriptor.

Parameters:
b - Short object to be passed by descriptor.

ByDesc

public ByDesc(java.lang.Byte b)
Pass a Byte object by descriptor.

Parameters:
b - Byte object to be passed by descriptor.

ByDesc

public ByDesc(Cmem b)
Pass a Cmem object by descriptor.

Parameters:
b - Cmem object to be passed by descriptor.