code: private int _prependOrWrite(char[] buffer, int ptr, char esc)
              throws IOException, JsonGenerationException
      {
          if (ptr > 0) { // fits, just prepend
              buffer[--ptr] = esc;
          } else { // won't fit, write
              _writer.write(esc);
          }
          return ptr;
      }
docs: Method called to try to either prepend character escape at front of
  given buffer; or if not possible, to write it out directly.
  
  @return Pointer to start of prepended entity (if prepended); or 'ptr'
  if not.