本文整理匯總了Java中io.vertx.core.buffer.Buffer.appendBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java Buffer.appendBytes方法的具體用法?Java Buffer.appendBytes怎麽用?Java Buffer.appendBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.buffer.Buffer
的用法示例。
在下文中一共展示了Buffer.appendBytes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: inputStreamToBuffer
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
private Buffer inputStreamToBuffer(InputStream input) throws IOException {
byte[] data = new byte[1024];
Buffer buffer = Buffer.buffer();
while (((input.read(data, 0, data.length))) != -1) {
buffer.appendBytes(data);
}
return buffer;
}
示例2: inputStreamToBuffer
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
private static Buffer inputStreamToBuffer(InputStream input) throws IOException {
byte[] data = new byte[1024];
Buffer buffer = Buffer.buffer();
while (((input.read(data, 0, data.length))) != -1) {
buffer.appendBytes(data);
}
return buffer;
}
示例3: toBuffer
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
/**
* Pumps the contents of an {@link InputStream} to a {@link Buffer}.
*
* @param is
* input stream
* @return buffer
*/
public static Buffer toBuffer(final InputStream is) throws IOException {
final Buffer b = Buffer.buffer(1024);
final byte[] buf = new byte[1024];
int len;
while ((len = is.read(buf)) >= 0) {
b.appendBytes(buf, 0, len);
}
return b;
}
示例4: bufferFromClasspathResource
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
public static Buffer bufferFromClasspathResource(final String path) {
final Buffer buffer = Buffer.buffer();
try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path)) {
final byte[] buf = new byte[1024];
int nRead;
while ((nRead = is.read(buf, 0, buf.length)) != -1) {
buffer.appendBytes(buf, 0, nRead);
}
return buffer;
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
示例5: encodeToWire
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
@Override
public void encodeToWire(final Buffer buffer,
final Envelop message) {
buffer.appendBytes(Stream.to(message));
}