Java 类org.apache.hadoop.hbase.util.ByteBufferOutputStream 实例源码

项目:IRIndex    文件:SecureServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (((SecureConnection)connection).useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (((SecureConnection)connection).saslServer) {
      token = ((SecureConnection)connection).saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    }
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}
项目:HBase-Research    文件:SecureServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (((SecureConnection)connection).useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (((SecureConnection)connection).saslServer) {
      token = ((SecureConnection)connection).saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    }
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}
项目:hbase-0.94.8-qod    文件:SecureServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (((SecureConnection)connection).useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (((SecureConnection)connection).saslServer) {
      token = ((SecureConnection)connection).saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    }
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}
项目:hbase-0.94.8-qod    文件:SecureServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (((SecureConnection)connection).useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (((SecureConnection)connection).saslServer) {
      token = ((SecureConnection)connection).saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    }
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}
项目:DominoHBase    文件:HBaseServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (connection.useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (connection.saslServer) {
      token = connection.saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isDebugEnabled())
      LOG.debug("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}
项目:DominoHBase    文件:HBaseServer.java   
/**
 * No protobuf encoding of raw sasl messages
 */
private void doRawSaslReply(SaslStatus status, Writable rv,
    String errorClass, String error) throws IOException {
  //In my testing, have noticed that sasl messages are usually
  //in the ballpark of 100-200. That's why the initialcapacity is 256.
  ByteBufferOutputStream saslResponse = new ByteBufferOutputStream(256);
  DataOutputStream out = new DataOutputStream(saslResponse);
  out.writeInt(status.state); // write status
  if (status == SaslStatus.SUCCESS) {
    rv.write(out);
  } else {
    WritableUtils.writeString(out, errorClass);
    WritableUtils.writeString(out, error);
  }
  saslCall.setSaslTokenResponse(saslResponse.getByteBuffer());
  saslCall.responder = responder;
  saslCall.sendResponseIfReady();
}
项目:hindex    文件:SecureServer.java   
private void wrapWithSasl(ByteBufferOutputStream response)
    throws IOException {
  if (((SecureConnection)connection).useSasl) {
    // getByteBuffer calls flip()
    ByteBuffer buf = response.getByteBuffer();
    byte[] token;
    // synchronization may be needed since there can be multiple Handler
    // threads using saslServer to wrap responses.
    synchronized (((SecureConnection)connection).saslServer) {
      token = ((SecureConnection)connection).saslServer.wrap(buf.array(),
          buf.arrayOffset(), buf.remaining());
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Adding saslServer wrapped token of size " + token.length
          + " as call response.");
    }
    buf.clear();
    DataOutputStream saslOut = new DataOutputStream(response);
    saslOut.writeInt(token.length);
    saslOut.write(token, 0, token.length);
  }
}