热门标签 | 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);
}

推荐阅读
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文介绍了UVALive6575题目Odd and Even Zeroes的解法,使用了数位dp和找规律的方法。阶乘的定义和性质被介绍,并给出了一些例子。其中,部分阶乘的尾零个数为奇数,部分为偶数。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 本文讨论了clone的fork与pthread_create创建线程的不同之处。进程是一个指令执行流及其执行环境,其执行环境是一个系统资源的集合。在调用系统调用fork创建一个进程时,子进程只是完全复制父进程的资源,这样得到的子进程独立于父进程,具有良好的并发性。但是二者之间的通讯需要通过专门的通讯机制,另外通过fork创建子进程系统开销很大。因此,在某些情况下,使用clone或pthread_create创建线程可能更加高效。 ... [详细]
  • 纠正网上的错误:自定义一个类叫java.lang.System/String的方法
    本文纠正了网上关于自定义一个类叫java.lang.System/String的错误答案,并详细解释了为什么这种方法是错误的。作者指出,虽然双亲委托机制确实可以阻止自定义的System类被加载,但通过自定义一个特殊的类加载器,可以绕过双亲委托机制,达到自定义System类的目的。作者呼吁读者对网上的内容持怀疑态度,并带着问题来阅读文章。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 关于我们EMQ是一家全球领先的开源物联网基础设施软件供应商,服务新产业周期的IoT&5G、边缘计算与云计算市场,交付全球领先的开源物联网消息服务器和流处理数据 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了南邮ctf-web的writeup,包括签到题和md5 collision。在CTF比赛和渗透测试中,可以通过查看源代码、代码注释、页面隐藏元素、超链接和HTTP响应头部来寻找flag或提示信息。利用PHP弱类型,可以发现md5('QNKCDZO')='0e830400451993494058024219903391'和md5('240610708')='0e462097431906509019562988736854'。 ... [详细]
  • 前景:当UI一个查询条件为多项选择,或录入多个条件的时候,比如查询所有名称里面包含以下动态条件,需要模糊查询里面每一项时比如是这样一个数组条件:newstring[]{兴业银行, ... [详细]
  • 本文介绍了一个题目的解法,通过二分答案来解决问题,但困难在于如何进行检查。文章提供了一种逃逸方式,通过移动最慢的宿管来锁门时跑到更居中的位置,从而使所有合格的寝室都居中。文章还提到可以分开判断两边的情况,并使用前缀和的方式来求出在任意时刻能够到达宿管即将锁门的寝室的人数。最后,文章提到可以改成O(n)的直接枚举来解决问题。 ... [详细]
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社区 版权所有