legacy/src/main/java/ucar/nc2/NetcdfFileWriteable.java
public void writeStringData(String fullNameEsc, int[] origin, Array values) throws java.io.IOException, InvalidRangeException {

    if (values.getElementType() != String.class)
      throw new IllegalArgumentException("Must be ArrayObject of String ");

    ucar.nc2.Variable v2 = findVariable(fullNameEsc);
    if (v2 == null)
      throw new IllegalArgumentException("illegal variable name = " + fullNameEsc);

    if (v2.getDataType() != DataType.CHAR)
      throw new IllegalArgumentException("variable " + fullNameEsc + " is not type CHAR");
    int rank = v2.getRank();
    int strlen = v2.getShape(rank-1);

    // turn it into an ArrayChar
    ArrayChar cvalues = ArrayChar.makeFromStringArray((ArrayObject) values, strlen);

    int[] corigin = new int[rank];
    System.arraycopy(origin, 0, corigin, 0, rank - 1);

    write(fullNameEsc, corigin, cvalues);
  }
public void writeStringData(String fullNameEsc, int[] origin, Array values) throws java.io.IOException, InvalidRangeException {

    if (values.getElementType() != String.class)
      throw new IllegalArgumentException("Must be ArrayObject of String ");

    ucar.nc2.Variable v2 = findVariable(fullNameEsc);
    if (v2 == null)
      throw new IllegalArgumentException("illegal variable name = " + fullNameEsc);

    if (v2.getDataType() != DataType.CHAR)
      throw new IllegalArgumentException("variable " + fullNameEsc + " is not type CHAR");
    int rank = v2.getRank();
    int strlen = v2.getShape(rank-1);

    // turn it into an ArrayChar
    ArrayChar cvalues = ArrayChar.makeFromStringArray((ArrayObject) values, strlen);

    int[] corigin = new int[rank];
    System.arraycopy(origin, 0, corigin, 0, rank - 1);

    write(fullNameEsc, corigin, cvalues);
  }
Write String data to a CHAR variable. Must not be in define mode.

@param fullNameEsc name of variable, must be of type CHAR.
@param origin  offset to start writing, ignore the strlen dimension.
@param values  write this array; must be ArrayObject of String
@throws IOException if I/O error
@throws ucar.ma2.InvalidRangeException if values Array has illegal shape