com.couchbase.client.deps.io.netty.buffer.ByteBuf.release()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(153)

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

ByteBuf.release介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

public static String getStringContent(Object content) {
  if (content instanceof String) {
    return (String) content;
  } else if (content instanceof byte[]) {
    return new String((byte[]) content, StandardCharsets.UTF_8);
  } else if (content instanceof ByteBuf) {
    final ByteBuf byteBuf = (ByteBuf) content;
    byte[] bytes = new byte[byteBuf.readableBytes()];
    byteBuf.readBytes(bytes);
    byteBuf.release();
    return new String(bytes, StandardCharsets.UTF_8);
  }
  return content.toString();
}

代码示例来源:origin: apache/incubator-gobblin

@Override
 public void onNext(D doc) {
  try {
   callbackFired.set(true);
   WriteResponse writeResponse = new GenericWriteResponse<D>(doc);
   writeResponseQueue.add(new Pair<WriteResponse, Throwable>(writeResponse, null));
   callback.onSuccess(writeResponse);
  } finally {
   if (doc instanceof TupleDocument) {
    ((TupleDocument) doc).content().value1().release();
   }
  }
 }
});

代码示例来源:origin: apache/nifi

private <V> V deserialize(BinaryDocument doc, Deserializer<V> valueDeserializer) throws IOException {
  if (doc == null) {
    return null;
  }
  final ByteBuf byteBuf = doc.content();
  final byte[] bytes = new byte[byteBuf.readableBytes()];
  byteBuf.readBytes(bytes);
  byteBuf.release();
  return valueDeserializer.deserialize(bytes);
}

代码示例来源:origin: apache/nifi

byteBuf.release();
};
doc = document;

代码示例来源:origin: com.couchbase.client/core-io

@Override
  public boolean release(int decrement) {
    return content.release(decrement);
  }
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public void delete() {
  if (byteBuf != null) {
    byteBuf.release();
    byteBuf = null;
  }
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public boolean release() {
  boolean result = false;
  if (extras != null) {
    result = extras.release();
  }
  if (framingExtras != null) {
    result = framingExtras.release();
  }
  return result;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
  public boolean release(int decrement) {
    return content.release(decrement);
  }
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
  public boolean release(int decrement) {
    return buf.release(decrement);
  }
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public boolean release(int decrement) {
  boolean result = false;
  if (extras != null) {
    result = extras.release(decrement);
  }
  if (framingExtras != null) {
    result = framingExtras.release(decrement);
  }
  return result;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public void close() throws IOException {
  try {
    super.close();
  } finally {
    // The Closable interface says "If the stream is already closed then invoking this method has no effect."
    if (releaseOnClose && !closed) {
      closed = true;
      buffer.release();
    }
  }
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
  public void call(ByteBuf byteBuf) {
    if (byteBuf != null && byteBuf.refCnt() > 0) {
      byteBuf.release();
    }
  }
};

代码示例来源:origin: apache/asterixdb

@Override
public boolean stop() {
  if (!stopped) {
    stopped = true;
    byteBuff.release();
  }
  return stopped;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public boolean release(int decrement) {
  super.release(decrement);
  return content.release(decrement);
}

代码示例来源:origin: com.couchbase.client/core-io

/**
 * Fills the {@link ByteBuf} with zero bytes and releases it.
 */
static void zerooutAndRelease(ByteBuf buffer) {
  zeroout(buffer);
  buffer.release();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public boolean release() {
  super.release();
  return content.release();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public boolean release() {
  super.release();
  return content.release();
}

代码示例来源:origin: com.couchbase.client/core-io

public void call(ByteBuf buf) {
    handle = buf.toString(CHARSET).replaceAll("^\"|\"$", "");
    buf.release();
    if (!sentResponse) {
      createResponse();
      LOGGER.trace("Received handle for requestId {}", requestID);
    }
  }
}),

代码示例来源:origin: com.couchbase.client/core-io

public void setValue(String value, int rank) {
  if (value == null) {
    throw new NullPointerException("value");
  }
  ByteBuf buf = Unpooled.copiedBuffer(value, charset);
  ByteBuf old = this.value.set(rank, buf);
  if (old != null) {
    size -= old.readableBytes();
    old.release();
  }
  size += buf.readableBytes();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public void readHeaderBlock(ByteBuf headerBlock) {
  try {
    spdyHeaderBlockDecoder.decode(ctx.alloc(), headerBlock, spdyHeadersFrame);
  } catch (Exception e) {
    ctx.fireExceptionCaught(e);
  } finally {
    headerBlock.release();
  }
}

相关文章