Annotation Interface Out


@Retention(CLASS) @Target(PARAMETER) public @interface Out
Configures an array parameter as an out-parameter. For an out-parameter, the array value is copied over the boundary from a called method. It may be combined with In for in-out parameters. Example showing the configuration for OutputStream.write(byte[], int, int).
 @Override
 public abstract int read(@Out(arrayOffsetParameter = "off", arrayLengthParameter = "len", trimToResult = true) byte[] b, int off, int len);
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Limits copying only to many of the elements given by the arrayLengthParameter parameter.
    Copy only a part of the array starting at offset given by the arrayOffsetParameter method parameter.
    boolean
    Limits copying only to method result number of elements.
  • Element Details

    • arrayOffsetParameter

      String arrayOffsetParameter
      Copy only a part of the array starting at offset given by the arrayOffsetParameter method parameter. By default, the whole array is copied. The arrayOffsetParameter can be used to improve the performance and copy only a part of the array over the boundary.
      Default:
      ""
    • arrayLengthParameter

      String arrayLengthParameter
      Limits copying only to many of the elements given by the arrayLengthParameter parameter. By default, the whole array is copied. The arrayLengthParameter can be used to improve the performance and copy only a part of the array over the boundary.
      Default:
      ""
    • trimToResult

      boolean trimToResult
      Limits copying only to method result number of elements. It can be used to further limit the number of copied elements in addition to arrayLengthParameter(). When used, it's still good to specify arrayLengthParameter() as an upper bound to limit allocated array size.
      Default:
      false