ch.qos.logback.core.encoder.Encoder.headerBytes()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中ch.qos.logback.core.encoder.Encoder.headerBytes()方法的一些代码示例,展示了Encoder.headerBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.headerBytes()方法的具体详情如下:
包路径:ch.qos.logback.core.encoder.Encoder
类名称:Encoder
方法名:headerBytes

Encoder.headerBytes介绍

[英]Get header bytes. This method is typically called upon opening of an output stream.
[中]获取头字节。此方法通常在打开输出流时调用。

代码示例

代码示例来源:origin: spring-projects/spring-amqp

private void sendOneEncoderPatternMessage(RabbitTemplate rabbitTemplate, String routingKey) {
  /*
   * If the encoder provides its pattern, send it as an additional one-time message.
   */
  if (AmqpAppender.this.encoder != null
      && AmqpAppender.this.headerWritten.compareAndSet(false, true)) {
    byte[] header = AmqpAppender.this.encoder.headerBytes();
    if (header != null && header.length > 0) {
      rabbitTemplate.convertAndSend(AmqpAppender.this.exchangeName, routingKey, header, m -> {
        if (AmqpAppender.this.applicationId != null) {
          m.getMessageProperties().setAppId(AmqpAppender.this.applicationId);
        }
        return m;
      });
    }
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

void encoderInit() {
  if (encoder != null && this.outputStream != null) {
    try {
      byte[] header = encoder.headerBytes();
      writeBytes(header);
    } catch (IOException ioe) {
      this.started = false;
      addStatus(new ErrorStatus("Failed to initialize encoder for appender named [" + name + "].", this, ioe));
    }
  }
}
protected void writeOut(E event) throws IOException {

代码示例来源:origin: org.springframework.amqp/spring-rabbit

private void sendOneEncoderPatternMessage(RabbitTemplate rabbitTemplate, String routingKey) {
  /*
   * If the encoder provides its pattern, send it as an additional one-time message.
   */
  if (AmqpAppender.this.encoder != null
      && AmqpAppender.this.headerWritten.compareAndSet(false, true)) {
    byte[] header = AmqpAppender.this.encoder.headerBytes();
    if (header != null && header.length > 0) {
      rabbitTemplate.convertAndSend(AmqpAppender.this.exchangeName, routingKey, header, m -> {
        if (AmqpAppender.this.applicationId != null) {
          m.getMessageProperties().setAppId(AmqpAppender.this.applicationId);
        }
        return m;
      });
    }
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

void encoderInit() {
  if (encoder != null && this.outputStream != null) {
    try {
      byte[] header = encoder.headerBytes();
      writeBytes(header);
    } catch (IOException ioe) {
      this.started = false;
      addStatus(new ErrorStatus("Failed to initialize encoder for appender named [" + name + "].", this, ioe));
    }
  }
}
protected void writeOut(E event) throws IOException {

代码示例来源:origin: Nextdoor/bender

void encoderInit() {
  if (encoder != null && this.outputStream != null) {
    try {
      byte[] header = encoder.headerBytes();
      writeBytes(header);
    } catch (IOException ioe) {
      this.started = false;
      addStatus(new ErrorStatus("Failed to initialize encoder for appender named [" + name + "].", this, ioe));
    }
  }
}
protected void writeOut(E event) throws IOException {

代码示例来源:origin: tony19/logback-android

void encoderInit() {
 if (encoder != null && this.outputStream != null) {
  try {
   byte[] header = encoder.headerBytes();
   writeBytes(header);
  } catch (IOException ioe) {
   this.started = false;
   addStatus(new ErrorStatus(
     "Failed to initialize encoder for appender named [" + name + "].",
     this, ioe));
  }
 }
}

相关文章