本文整理了Java中org.apache.activemq.util.ByteArrayInputStream.
方法的一些代码示例,展示了ByteArrayInputStream.
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteArrayInputStream.
方法的具体详情如下:
包路径:org.apache.activemq.util.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
return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
}
代码示例来源:origin: apache/activemq
private Map
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);
}