热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.activemq.util.ByteArrayInputStream.()方法的使用及代码示例

本文整理了Java中org.apache.activemq.util.ByteArrayInputStream.<init>()方法的一些代码示例,展示了

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

ByteArrayInputStream.介绍

暂无

代码示例

代码示例来源:origin: apache/activemq

/**
* @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement,
* int, byte[])
*/
@Override
protected void setBinaryData(PreparedStatement s, int index, byte[] data) throws SQLException {
s.setBinaryStream(index, new ByteArrayInputStream(data), data.length);
}

代码示例来源:origin: apache/activemq

private boolean evaluate(byte[] data) {
try {
InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
Document inputDocument = builder.parse(inputSource);
return ((Boolean) xpath.evaluate(xpathExpression, inputDocument, XPathConstants.BOOLEAN)).booleanValue();
} catch (Exception e) {
return false;
}
}

代码示例来源:origin: apache/activemq

private boolean evaluate(byte[] data) {
try {
InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
Document inputDocument = builder.parse(inputSource);
return ((Boolean)xpath.evaluate(xpathExpression, inputDocument, XPathConstants.BOOLEAN)).booleanValue();
} catch (Exception e) {
return false;
}
}

代码示例来源:origin: apache/activemq

private Map unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
}

代码示例来源:origin: apache/activemq

private Map unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)));
}

代码示例来源:origin: apache/activemq

public Object unmarshal(ByteSequence packet) throws IOException {
return unmarshal(new DataInputStream(new ByteArrayInputStream(packet)));
}

代码示例来源:origin: apache/activemq

public Command read() throws IOException {
Command answer = null;
Endpoint from = null;
synchronized (readLock) {
while (true) {
DatagramPacket datagram = createDatagramPacket();
channel.receive(datagram);
// TODO could use a DataInput implementation that talks direct
// to the byte[] to avoid object allocation
receiveCounter++;
DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(datagram.getData(), 0, datagram.getLength()));

from = headerMarshaller.createEndpoint(datagram, dataIn);
answer = (Command)wireFormat.unmarshal(dataIn);
break;
}
}
if (answer != null) {
answer.setFrom(from);
if (LOG.isDebugEnabled()) {
LOG.debug("Channel: " + name + " about to process: " + answer);
}
}
return answer;
}

代码示例来源:origin: apache/activemq

DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(data));
answer = (Command)wireFormat.unmarshal(dataIn);
break;

代码示例来源:origin: apache/activemq

private void initializeReading() throws MessageNotReadableException {
checkWriteOnlyBody();
if (this.dataIn == null) {
ByteSequence data = getContent();
if (data == null) {
data = new ByteSequence(new byte[] {}, 0, 0);
}
InputStream is = new ByteArrayInputStream(data);
if (isCompressed()) {
is = new InflaterInputStream(is);
is = new BufferedInputStream(is);
}
this.dataIn = new DataInputStream(is);
}
}

代码示例来源:origin: apache/activemq

private String decodeContent(ByteSequence bodyAsBytes) throws JMSException {
String text = null;
if (bodyAsBytes != null) {
InputStream is = null;
try {
is = new ByteArrayInputStream(bodyAsBytes);
if (isCompressed()) {
is = new InflaterInputStream(is);
}
DataInputStream dataIn = new DataInputStream(is);
text = MarshallingSupport.readUTF8(dataIn);
dataIn.close();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
// ignore
}
}
}
}
return text;
}

代码示例来源:origin: apache/activemq

/**
* Builds the message body from data
*
* @throws JMSException
* @throws IOException
*/
private void loadContent() throws JMSException {
try {
if (getContent() != null && map.isEmpty()) {
ByteSequence cOntent= getContent();
InputStream is = new ByteArrayInputStream(content);
if (isCompressed()) {
is = new InflaterInputStream(is);
}
DataInputStream dataIn = new DataInputStream(is);
map = MarshallingSupport.unmarshalPrimitiveMap(dataIn);
dataIn.close();
}
} catch (IOException e) {
throw JMSExceptionSupport.create(e);
}
}

代码示例来源:origin: apache/activemq

private void initializeReading() throws JMSException {
checkWriteOnlyBody();
if (dataIn == null) {
try {
ByteSequence data = getContent();
if (data == null) {
data = new ByteSequence(new byte[] {}, 0, 0);
}
InputStream is = new ByteArrayInputStream(data);
if (isCompressed()) {
if (data.length != 0) {
is = new ByteArrayInputStream(decompress(data));
}
} else {
length = data.getLength();
}
dataIn = new DataInputStream(is);
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
}
}
}

代码示例来源:origin: apache/activemq

public void onCommand(Object o) {
Command command = (Command)o;
byte type = command.getDataStructureType();
if (type == PartialCommand.DATA_STRUCTURE_TYPE || type == LastPartialCommand.DATA_STRUCTURE_TYPE) {
PartialCommand header = (PartialCommand)command;
byte[] partialData = header.getData();
try {
out.write(partialData);
} catch (IOException e) {
getTransportListener().onException(e);
}
if (type == LastPartialCommand.DATA_STRUCTURE_TYPE) {
try {
byte[] fullData = out.toByteArray();
out.reset();
DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(fullData));
Command completeCommand = (Command)wireFormat.unmarshal(dataIn);
LastPartialCommand lastCommand = (LastPartialCommand)command;
lastCommand.configure(completeCommand);
getTransportListener().onCommand(completeCommand);
} catch (IOException e) {
LOG.warn("Failed to unmarshal partial command: " + command);
getTransportListener().onException(e);
}
}
} else {
getTransportListener().onCommand(command);
}
}

代码示例来源:origin: apache/activemq

try {
ByteSequence cOntent= getContent();
InputStream is = new ByteArrayInputStream(content);
if (isCompressed()) {
is = new InflaterInputStream(is);

代码示例来源:origin: apache/activemq

try {
if (compressed) {
ByteArrayInputStream input = new ByteArrayInputStream(this.content.getData(), this.content.getOffset(), this.content.getLength());
InflaterInputStream inflater = new InflaterInputStream(input);
try {

代码示例来源:origin: org.apache.activemq/activemq-jdbc-store

/**
* @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement,
* int, byte[])
*/
@Override
protected void setBinaryData(PreparedStatement s, int index, byte[] data) throws SQLException {
s.setBinaryStream(index, new ByteArrayInputStream(data), data.length);
}

代码示例来源:origin: org.apache.activemq/activemq-optional

private boolean evaluate(byte[] data) {
try {
InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
return ((Boolean)expression.evaluate(inputSource, XPathConstants.BOOLEAN)).booleanValue();
} catch (XPathExpressionException e) {
return false;
}
}

代码示例来源:origin: org.apache.activemq/activemq-broker

private boolean evaluate(byte[] data) {
try {
InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
Document inputDocument = builder.parse(inputSource);
return ((Boolean) xpath.evaluate(xpathExpression, inputDocument, XPathConstants.BOOLEAN)).booleanValue();
} catch (Exception e) {
return false;
}
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public Object unmarshal(ByteSequence packet) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(packet);
DataInputStream dis = new DataInputStream(stream);
return unmarshal(dis);
}

代码示例来源:origin: org.apache.activemq/activemq-mqtt

@Override
public Object unmarshal(ByteSequence packet) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(packet);
DataInputStream dis = new DataInputStream(stream);
return unmarshal(dis);
}

推荐阅读
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • ALTERTABLE通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。语法ALTERTABLEtable{[ALTERCOLUMNcolu ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 本文介绍了在满足特定条件时如何在输入字段中使用默认值的方法和相应的代码。当输入字段填充100或更多的金额时,使用50作为默认值;当输入字段填充有-20或更多(负数)时,使用-10作为默认值。文章还提供了相关的JavaScript和Jquery代码,用于动态地根据条件使用默认值。 ... [详细]
  • 本文整理了Java中org.gwtbootstrap3.client.ui.Icon.addDomHandler()方法的一些代码示例,展示了Icon.ad ... [详细]
  • Iwanttointegratesort,order,maxandoffsetinafindAllquery.Thefollowingworksfine:我想在fin ... [详细]
  • 本文介绍了一个Java猜拳小游戏的代码,通过使用Scanner类获取用户输入的拳的数字,并随机生成计算机的拳,然后判断胜负。该游戏可以选择剪刀、石头、布三种拳,通过比较两者的拳来决定胜负。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • HDFS2.x新特性
    一、集群间数据拷贝scp实现两个远程主机之间的文件复制scp-rhello.txtroothadoop103:useratguiguhello.txt推pushscp-rr ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • 高质量SQL书写的30条建议
    本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ... [详细]
  • Go Cobra命令行工具入门教程
    本文介绍了Go语言实现的命令行工具Cobra的基本概念、安装方法和入门实践。Cobra被广泛应用于各种项目中,如Kubernetes、Hugo和Github CLI等。通过使用Cobra,我们可以快速创建命令行工具,适用于写测试脚本和各种服务的Admin CLI。文章还通过一个简单的demo演示了Cobra的使用方法。 ... [详细]
  • 如何搭建Java开发环境并开发WinCE项目
    本文介绍了如何搭建Java开发环境并开发WinCE项目,包括搭建开发环境的步骤和获取SDK的几种方式。同时还解答了一些关于WinCE开发的常见问题。通过阅读本文,您将了解如何使用Java进行嵌入式开发,并能够顺利开发WinCE应用程序。 ... [详细]
  • 本文介绍了在CentOS上安装Python2.7.2的详细步骤,包括下载、解压、编译和安装等操作。同时提供了一些注意事项,以及测试安装是否成功的方法。 ... [详细]
author-avatar
鱼儿玩玩
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有