コード例 #1
0
 /** {@inheritDoc} */
 public int toHost(
     final ICobolArrayDbcsBinding ce,
     final byte[] hostTarget,
     final int offset,
     final int currentOccurs)
     throws HostException {
   int newOffset = offset;
   try {
     for (String javaSource : ce.getStringList()) {
       newOffset =
           toHostSingle(
               javaSource,
               getCobolContext().getHostCharsetName(),
               ce.getItemByteLength(),
               ce.isJustifiedRight(),
               hostTarget,
               newOffset);
     }
     /* If necessary, fill in the array with missing items */
     for (int i = ce.getStringList().size(); i < currentOccurs; i++) {
       newOffset =
           toHostSingle(
               "",
               getCobolContext().getHostCharsetName(),
               ce.getItemByteLength(),
               ce.isJustifiedRight(),
               hostTarget,
               newOffset);
     }
   } catch (CobolConversionException e) {
     throwHostException(ce, e);
   }
   return newOffset;
 }
コード例 #2
0
 /** {@inheritDoc} */
 public int fromHost(
     final ICobolArrayDbcsBinding ce,
     final byte[] hostSource,
     final int offset,
     final int currentOccurs)
     throws HostException {
   List<String> lArray = new ArrayList<String>();
   int newOffset = offset;
   try {
     for (int i = 0; i < currentOccurs; i++) {
       String javaString =
           fromHostSingle(
               getCobolContext().getHostCharsetName(),
               ce.getItemByteLength(),
               hostSource,
               newOffset);
       lArray.add(javaString);
       newOffset += ce.getItemByteLength();
     }
     ce.setStringList(lArray);
   } catch (CobolConversionException e) {
     throwHostException(ce, e);
   }
   return newOffset;
 }