okio.Buffer.writeString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(122)

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

Buffer.writeString介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

/**
 * Returns a new response body that transmits {@code content}. If {@code contentType} is non-null
 * and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(@Nullable MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

/**
 * Returns a new response body that transmits {@code content}. If {@code contentType} is non-null
 * and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(@Nullable MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: square/okhttp

encodedCharBuffer.writeUtf8CodePoint(codePoint);
} else {
 encodedCharBuffer.writeString(input, i, i + Character.charCount(codePoint), charset);

代码示例来源:origin: com.squareup.okhttp3/okhttp

encodedCharBuffer.writeUtf8CodePoint(codePoint);
} else {
 encodedCharBuffer.writeString(input, i, i + Character.charCount(codePoint), charset);

代码示例来源:origin: huxq17/tractor

@Override public Buffer writeString(String string, Charset charset) {
 return writeString(string, 0, string.length(), charset);
}

代码示例来源:origin: Gitteroid/GitterJavaSDK

public static Buffer writeString(String source) {
 return new Buffer().writeString(source, Charset.defaultCharset());
}

代码示例来源:origin: huxq17/tractor

@Override public BufferedSink writeString(String string, int beginIndex, int endIndex,
  Charset charset) throws IOException {
 if (closed) throw new IllegalStateException("closed");
 buffer.writeString(string, beginIndex, endIndex, charset);
 return emitCompleteSegments();
}

代码示例来源:origin: huxq17/tractor

@Override public BufferedSink writeString(String string, Charset charset) throws IOException {
 if (closed) throw new IllegalStateException("closed");
 buffer.writeString(string, charset);
 return emitCompleteSegments();
}

代码示例来源:origin: com.github.ljun20160606/okhttp

/**
 * Returns a new response body that transmits {@code content}. If {@code contentType} is non-null
 * and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(@Nullable MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: duzechao/OKHttpUtils

/**
 * Returns a new response body that transmits {@code content}. If {@code contentType} is non-null
 * and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns a new response body that transmits {@code content}. If {@code contentType} is non-null
 * and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(@Nullable MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: io.apptik.comm/jus-java

public static NetworkRequest create(MediaType mediaType, String data) {
  Utils.checkNotNull(mediaType, "mediaType==null");
  return create(mediaType, new Buffer()
      .writeString(data, mediaType.charset(Charset.forName(HTTP.UTF_8)))
      .readByteArray());
}

代码示例来源:origin: huxq17/SwipeCardsView

/**
 * Returns a new response body that transmits {@code content}. If {@code
 * contentType} is non-null and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: io.apptik.comm/jus-java

public static NetworkResponse create(MediaType mediaType, String data) {
  Utils.checkNotNull(mediaType, "mediaType==null");
  return create(mediaType, new Buffer()
      .writeString(data, mediaType.charset(Charset.forName(HTTP.UTF_8)))
      .readByteArray());
}

代码示例来源:origin: huxq17/tractor

/**
 * Returns a new response body that transmits {@code content}. If {@code
 * contentType} is non-null and lacks a charset, this will use UTF-8.
 */
public static ResponseBody create(MediaType contentType, String content) {
 Charset charset = UTF_8;
 if (contentType != null) {
  charset = contentType.charset();
  if (charset == null) {
   charset = UTF_8;
   contentType = MediaType.parse(contentType + "; charset=utf-8");
  }
 }
 Buffer buffer = new Buffer().writeString(content, charset);
 return create(contentType, buffer.size(), buffer);
}

代码示例来源:origin: com.github.ljun20160606/okhttp

encodedCharBuffer.writeUtf8CodePoint(codePoint);
} else {
 encodedCharBuffer.writeString(input, i, i + Character.charCount(codePoint), charset);

代码示例来源:origin: apache/servicemix-bundles

encodedCharBuffer.writeUtf8CodePoint(codePoint);
} else {
 encodedCharBuffer.writeString(input, i, i + Character.charCount(codePoint), charset);

相关文章