CharsetEnum.getCharset
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using top.wboost.common.base.enums.CharsetEnum.getCharset (Showing top 16 results out of 315)

origin: top.wboost/common-web

/**
 * @since 4.4
 */
public HttpRequestBuilder setCharset(final CharsetEnum charset) {
  this.charset = charset.getCharset();
  return this;
}
origin: top.wboost/common-web

/**
 * Constructor with method, URL, headers, body and type.
 * @param body the body
 * @param headers the headers
 * @param method the method
 * @param url the URL
 * @param type the type used for generic type resolution
 * @since 4.3
 */
public RequestEntity(T body, MultiValueMap<String, String> headers, HttpMethod method, URI url, Type type) {
  this(body, headers, method, url, null, CharsetEnum.UTF_8.getCharset());
}
origin: top.wboost/common-web

public DefaultBodyBuilder(HttpMethod method, String url) {
  this.method = method;
  this.url = url;
  this.charsetResolve = CharsetEnum.UTF_8.getCharset();
  this.headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
}
origin: top.wboost/common-kylin

/**
 * 获得认证信息
 * @return
 */
public String getAuthentication() {
  return "Basic " + EncryptUtil.encodeBase64((name + ":" + password).getBytes(CharsetEnum.UTF_8.getCharset()));
}
origin: top.wboost/common-netty

@Override
public void channelReadInternal(NettyProtocol read) {
  System.out.println(new String(read.getContent(), CharsetEnum.UTF_8.getCharset()));
}
origin: top.wboost/common-netty

public String stringVale() {
  return new String(getContent(), CharsetEnum.UTF_8.getCharset());
}
origin: top.wboost/common-utils-web

public static String importFileNio(FileInputStream inputStream, CharsetEnum charset) {
  byte[] result = null;
  try (FileChannel channel = inputStream.getChannel()) {
    long allByteLength = channel.size();
    ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
    int nowByteLength = 0;
    result = new byte[Integer.parseInt(String.valueOf(allByteLength))];
    while (channel.read(byteBuffer) != -1) {
      int position = byteBuffer.position();
      System.arraycopy(byteBuffer.array(), 0, result, nowByteLength, position);
      nowByteLength += position;
      byteBuffer.clear();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return new String(result, charset.getCharset());
}
origin: top.wboost/common-utils-web

public static List<String> importText(InputStream inputStream) {
  Reader reader = null;
  BufferedReader br = null;
  List<String> list = null;
  try {
    reader = new InputStreamReader(inputStream);
    br = new BufferedReader(reader);
    list = new ArrayList<String>();
    String str = "";
    while ((str = br.readLine()) != null) {
      list.add(new String(str.getBytes(), CharsetEnum.ISO_8859_1.getCharset()));
    }
  } catch (Exception e) {
    log.error("读取文件出错,原因为:" + e);
  } finally {
    IOUtils.closeQuietly(br);
    IOUtils.closeQuietly(reader);
  }
  return list;
}
origin: top.wboost/common-netty

  @Override
  public void channelReadInternal(NettyProtocol read) throws Exception {
    System.out.println(new String(read.getContent(), CharsetEnum.UTF_8.getCharset()));
    write("success!");
  }
}
origin: top.wboost/common-netty

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  T buf = (T) msg;
  String request = new String(buf.getContent(), CharsetEnum.UTF_8.getCharset());
  channelReadInternal(ctx, request);
}
origin: top.wboost/common-netty

public void write(String content) throws Exception {
  getCtx().writeAndFlush(new NettyProtocol(content.getBytes(CharsetEnum.UTF_8.getCharset())));
}
origin: top.wboost/common-utils

StringBuffer stringBuffer = new StringBuffer();
while ((len = stream.read(b)) != -1) {
  stringBuffer.append(new String(b, 0, len, CharsetEnum.UTF_8.getCharset()));
origin: top.wboost/common-web

/**
 * 原生HttpClient使用方法
 * @author jwSun
 * @date 2017年6月14日 下午4:21:29
 * @param request
 * @return
 */
public static ResponseEntity<String> execute(HttpRequestBase request, HttpClient httpClient) {
  try {
    HttpResponse response = httpClient.execute(request);
    HttpEntity responseEntity = response.getEntity();
    String body = EntityUtils.toString(responseEntity, CharsetEnum.UTF_8.getCharset());
    EntityUtils.consume(response.getEntity());
    return ResponseEntity.status(response.getStatusLine().getStatusCode()).body(body);
  } catch (Exception e) {
    log.error(e.getLocalizedMessage());
    throw new ConnectionException(request.toString(), e);
  } finally {
    request.releaseConnection();
  }
}
origin: top.wboost/common-utils-web

private static EncodedResource[] loadResources(String location) {
  try {
    Resource[] resources = resourceResolver.getResources(location);
    EncodedResource[] encodeResources = new EncodedResource[resources.length];
    for (int i = 0; i < resources.length; i++) {
      Resource resource = resources[i];
      encodeResources[i] = new EncodedResource(resource, CharsetEnum.UTF_8.getCharset());
    }
    return encodeResources;
  } catch (Exception e) {
    log.error("loadResource error", e);
    throw new BusinessException("loadResource error");
  }
}
origin: top.wboost/common-utils-web

  if (val != null)
    val = new String(val.getBytes(CharsetEnum.ISO_8859_1.getName()),
        CharsetEnum.UTF_8.getCharset());
} else {
  val = ConfigProperties.localenv.getProperty(name, defaultVal);
origin: top.wboost/common-kylin

@Override
public String executeQueryBody(KylinBodySearch kylinBodySearch) {
  StringEntity stringEntity = new StringEntity(kylinBodySearch.searchJson(), CharsetEnum.UTF_8.getCharset());
  stringEntity.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
  ResponseEntity<String> responseBody = HttpClientUtil
      .execute(HttpRequestBuilder.post(kylinUrl + API + QUERY).setEntity(stringEntity), getHttpClient());
  Callback callback = checkResult(responseBody);
  if (callback == Callback.RESTART) {
    return executeQueryBody(kylinBodySearch);
  } else if (callback == Callback.RETURN) {
    return responseBody.getBody();
  } else {
    throw new KylinUnKnowException("responseBody is : " + responseBody);
  }
}
top.wboost.common.base.enumsCharsetEnumgetCharset

Popular methods of CharsetEnum

  • getName

Popular in Java

  • Running tasks concurrently on multiple threads
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)