本文整理了Java中akka.util.ByteString.fromArray()
方法的一些代码示例,展示了ByteString.fromArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.fromArray()
方法的具体详情如下:
包路径:akka.util.ByteString
类名称:ByteString
方法名:fromArray
暂无
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Set a Binary Data to this request.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @param tempFileCreator the temporary file creator for binary data.
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data, Files.TemporaryFileCreator tempFileCreator) {
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play
/**
* Set a Binary Data to this request.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @param tempFileCreator the temporary file creator for binary data.
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data, Files.TemporaryFileCreator tempFileCreator) {
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Set a Binary Data to this request.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @param tempFileCreator the temporary file creator for binary data.
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data, Files.TemporaryFileCreator tempFileCreator) {
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play
/**
* Set a Binary Data to this request using a singleton temporary file creator.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data) {
Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator();
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Set a Binary Data to this request using a singleton temporary file creator.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data) {
Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator();
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Set a Binary Data to this request using a singleton temporary file creator.
* The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>.
*
* @param data the Binary Data
* @return the modified builder
*/
public RequestBuilder bodyRaw(byte[] data) {
Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator();
return bodyRaw(ByteString.fromArray(data), tempFileCreator);
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Generates a simple result with byte-array content.
*
* @param status the HTTP status for this result e.g. 200 (OK), 404 (NOT_FOUND)
* @param content the result's body content, as a byte array
* @return the result
*/
public static Result status(int status, byte[] content) {
if (content == null) {
throw new NullPointerException("Null content");
}
return new Result(status, new HttpEntity.Strict(ByteString.fromArray(content), Optional.empty()));
}
代码示例来源:origin: com.typesafe.play/play
/**
* Generates a simple result with byte-array content.
*
* @param status the HTTP status for this result e.g. 200 (OK), 404 (NOT_FOUND)
* @param content the result's body content, as a byte array
* @return the result
*/
public static Result status(int status, byte[] content) {
if (content == null) {
throw new NullPointerException("Null content");
}
return new Result(status, new HttpEntity.Strict(ByteString.fromArray(content), Optional.empty()));
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Generates a simple result with byte-array content.
*
* @param status the HTTP status for this result e.g. 200 (OK), 404 (NOT_FOUND)
* @param content the result's body content, as a byte array
* @return the result
*/
public static Result status(int status, byte[] content) {
if (content == null) {
throw new NullPointerException("Null content");
}
return new Result(status, new HttpEntity.Strict(ByteString.fromArray(content), Optional.empty()));
}
代码示例来源:origin: com.typesafe.play/play
return (ByteString) body;
} else if (body instanceof byte[]) {
return ByteString.fromArray((byte[]) body);
} else if (body instanceof String) {
return ByteString.fromString((String) body);
代码示例来源:origin: com.typesafe.play/play_2.12
return (ByteString) body;
} else if (body instanceof byte[]) {
return ByteString.fromArray((byte[]) body);
} else if (body instanceof String) {
return ByteString.fromString((String) body);
代码示例来源:origin: com.typesafe.play/play_2.11
return (ByteString) body;
} else if (body instanceof byte[]) {
return ByteString.fromArray((byte[]) body);
} else if (body instanceof String) {
return ByteString.fromString((String) body);
代码示例来源:origin: com.typesafe.play/play-ws-standalone
/**
* Creates a {@link InMemoryBodyWritable} from a byte array.
*
* @param array the byte array to pass in.
* @param contentType to pass in.
* @return a {@link InMemoryBodyWritable} instance.
*/
default BodyWritable<ByteString> body(byte[] array, String contentType) {
return new InMemoryBodyWritable(ByteString.fromArray(array), contentType);
}
代码示例来源:origin: com.typesafe.play/play-ws-standalone_2.12
/**
* Creates a {@link InMemoryBodyWritable} from a byte array.
*
* @param array the byte array to pass in.
* @param contentType to pass in.
* @return a {@link InMemoryBodyWritable} instance.
*/
default BodyWritable<ByteString> body(byte[] array, String contentType) {
return new InMemoryBodyWritable(ByteString.fromArray(array), contentType);
}
代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone
@Override
public ByteString getBodyAsBytes() {
return ByteString.fromArray(this.ahcResponse.getResponseBodyAsBytes());
}
代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone_2.12
@Override
public ByteString getBodyAsBytes() {
return ByteString.fromArray(this.ahcResponse.getResponseBodyAsBytes());
}
代码示例来源:origin: com.github.rmannibucau/playx-servlet
public void onComplete() {
if (completion.isDone()) {
return;
}
try {
flushBuffer();
} catch (final IOException e) {
// no-op
}
final String contentType = headers.remove("Content-Type");
headers.remove("Content-Length");
completion.complete(new Result(status, headers,
new HttpEntity.Strict(ByteString.fromArray(output.toByteArray()), ofNullable(contentType))));
}
代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone
@Override
public Source<ByteString, ?> getBodyAsSource() {
return Source.fromPublisher(publisher).map(bodyPart -> ByteString.fromArray(bodyPart.getBodyPartBytes()));
}
代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone_2.12
@Override
public Source<ByteString, ?> getBodyAsSource() {
return Source.fromPublisher(publisher).map(bodyPart -> ByteString.fromArray(bodyPart.getBodyPartBytes()));
}
内容来源于网络,如有侵权,请联系作者删除!