handleEOD method

  1. @override
void handleEOD(
  1. EncoderContext context,
  2. StringBuffer buffer
)
override

Handle "end of data" situations

@param context the encoder context @param buffer the buffer with the remaining encoded characters

Implementation

@override
void handleEOD(EncoderContext context, StringBuffer buffer) {
  context.updateSymbolInfo();
  final available = context.symbolInfo!.dataCapacity - context.codewordCount;
  final count = buffer.length;
  context.pos -= count;
  if (context.remainingCharacters > 1 ||
      available > 1 ||
      context.remainingCharacters != available) {
    context.writeCodeword(HighLevelEncoder.x12Unlatch);
  }
  if (context.newEncoding < 0) {
    context.signalEncoderChange(HighLevelEncoder.asciiEncodation);
  }
}