- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.catalina.tribes.io.XByteBuffer.setLength()
方法的一些代码示例,展示了XByteBuffer.setLength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XByteBuffer.setLength()
方法的具体详情如下:
包路径:org.apache.catalina.tribes.io.XByteBuffer
类名称:XByteBuffer
方法名:setLength
暂无
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Extracts the message bytes from a package.
* If no package exists, a IllegalStateException will be thrown.
* @param clearFromBuffer - if true, the package will be removed from the byte buffer
* @return - returns the actual message bytes (header, compress,size and footer not included).
*/
public XByteBuffer extractDataPackage(boolean clearFromBuffer) {
int psize = countPackages(true);
if (psize == 0) {
throw new java.lang.IllegalStateException("No package exists in XByteBuffer");
}
int size = toInt(buf, START_DATA.length);
XByteBuffer xbuf = BufferPool.getBufferPool().getBuffer(size,false);
xbuf.setLength(size);
System.arraycopy(buf, START_DATA.length + 4, xbuf.getBytesDirect(), 0, size);
if (clearFromBuffer) {
int totalsize = START_DATA.length + 4 + size + END_DATA.length;
bufSize = bufSize - totalsize;
System.arraycopy(buf, totalsize, buf, 0, bufSize);
}
return xbuf;
}
代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource
/**
* Extracts the message bytes from a package.
* If no package exists, a IllegalStateException will be thrown.
* @param clearFromBuffer - if true, the package will be removed from the byte buffer
* @return - returns the actual message bytes (header, compress,size and footer not included).
*/
public XByteBuffer extractDataPackage(boolean clearFromBuffer) {
int psize = countPackages(true);
if (psize == 0) {
throw new java.lang.IllegalStateException("No package exists in XByteBuffer");
}
int size = toInt(buf, START_DATA.length);
XByteBuffer xbuf = BufferPool.getBufferPool().getBuffer(size,false);
xbuf.setLength(size);
System.arraycopy(buf, START_DATA.length + 4, xbuf.getBytesDirect(), 0, size);
if (clearFromBuffer) {
int totalsize = START_DATA.length + 4 + size + END_DATA.length;
bufSize = bufSize - totalsize;
System.arraycopy(buf, totalsize, buf, 0, bufSize);
}
return xbuf;
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes
/**
* Extracts the message bytes from a package.
* If no package exists, a IllegalStateException will be thrown.
* @param clearFromBuffer - if true, the package will be removed from the byte buffer
* @return - returns the actual message bytes (header, compress,size and footer not included).
*/
public XByteBuffer extractDataPackage(boolean clearFromBuffer) {
int psize = countPackages(true);
if (psize == 0) {
throw new java.lang.IllegalStateException("No package exists in XByteBuffer");
}
int size = toInt(buf, START_DATA.length);
XByteBuffer xbuf = BufferPool.getBufferPool().getBuffer(size,false);
xbuf.setLength(size);
System.arraycopy(buf, START_DATA.length + 4, xbuf.getBytesDirect(), 0, size);
if (clearFromBuffer) {
int totalsize = START_DATA.length + 4 + size + END_DATA.length;
bufSize = bufSize - totalsize;
System.arraycopy(buf, totalsize, buf, 0, bufSize);
}
return xbuf;
}
代码示例来源:origin: org.apache.tomcat/tomcat-tribes
/**
* Extracts the message bytes from a package.
* If no package exists, a IllegalStateException will be thrown.
* @param clearFromBuffer - if true, the package will be removed from the byte buffer
* @return - returns the actual message bytes (header, compress,size and footer not included).
*/
public XByteBuffer extractDataPackage(boolean clearFromBuffer) {
int psize = countPackages(true);
if (psize == 0) {
throw new java.lang.IllegalStateException(sm.getString("xByteBuffer.no.package"));
}
int size = toInt(buf, START_DATA.length);
XByteBuffer xbuf = BufferPool.getBufferPool().getBuffer(size,false);
xbuf.setLength(size);
System.arraycopy(buf, START_DATA.length + 4, xbuf.getBytesDirect(), 0, size);
if (clearFromBuffer) {
int totalsize = START_DATA.length + 4 + size + END_DATA.length;
bufSize = bufSize - totalsize;
System.arraycopy(buf, totalsize, buf, 0, bufSize);
}
return xbuf;
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Deserializes a ChannelData object from a byte array
* @param xbuf byte[]
* @return ChannelData
*/
public static ChannelData getDataFromPackage(XByteBuffer xbuf) {
ChannelData data = new ChannelData(false);
int offset = 0;
data.setOptions(XByteBuffer.toInt(xbuf.getBytesDirect(),offset));
offset += 4; //options
data.setTimestamp(XByteBuffer.toLong(xbuf.getBytesDirect(),offset));
offset += 8; //timestamp
data.uniqueId = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
offset += 4; //uniqueId length
System.arraycopy(xbuf.getBytesDirect(),offset,data.uniqueId,0,data.uniqueId.length);
offset += data.uniqueId.length; //uniqueId data
//byte[] addr = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
int addrlen = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //addr length
//System.arraycopy(xbuf.getBytesDirect(),offset,addr,0,addr.length);
data.setAddress(MemberImpl.getMember(xbuf.getBytesDirect(),offset,addrlen));
//offset += addr.length; //addr data
offset += addrlen;
int xsize = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //xsize length
System.arraycopy(xbuf.getBytesDirect(),offset,xbuf.getBytesDirect(),0,xsize);
xbuf.setLength(xsize);
data.message = xbuf;
return data;
}
代码示例来源:origin: org.apache.tomcat/tomcat-tribes
/**
* Deserializes a ChannelData object from a byte array
* @param xbuf byte[]
* @return ChannelData
*/
public static ChannelData getDataFromPackage(XByteBuffer xbuf) {
ChannelData data = new ChannelData(false);
int offset = 0;
data.setOptions(XByteBuffer.toInt(xbuf.getBytesDirect(),offset));
offset += 4; //options
data.setTimestamp(XByteBuffer.toLong(xbuf.getBytesDirect(),offset));
offset += 8; //timestamp
data.uniqueId = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
offset += 4; //uniqueId length
System.arraycopy(xbuf.getBytesDirect(),offset,data.uniqueId,0,data.uniqueId.length);
offset += data.uniqueId.length; //uniqueId data
//byte[] addr = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
int addrlen = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //addr length
//System.arraycopy(xbuf.getBytesDirect(),offset,addr,0,addr.length);
data.setAddress(MemberImpl.getMember(xbuf.getBytesDirect(),offset,addrlen));
//offset += addr.length; //addr data
offset += addrlen;
int xsize = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //xsize length
System.arraycopy(xbuf.getBytesDirect(),offset,xbuf.getBytesDirect(),0,xsize);
xbuf.setLength(xsize);
data.message = xbuf;
return data;
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes
/**
* Deserializes a ChannelData object from a byte array
* @param xbuf byte[]
* @return ChannelData
*/
public static ChannelData getDataFromPackage(XByteBuffer xbuf) {
ChannelData data = new ChannelData(false);
int offset = 0;
data.setOptions(XByteBuffer.toInt(xbuf.getBytesDirect(),offset));
offset += 4; //options
data.setTimestamp(XByteBuffer.toLong(xbuf.getBytesDirect(),offset));
offset += 8; //timestamp
data.uniqueId = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
offset += 4; //uniqueId length
System.arraycopy(xbuf.getBytesDirect(),offset,data.uniqueId,0,data.uniqueId.length);
offset += data.uniqueId.length; //uniqueId data
//byte[] addr = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
int addrlen = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //addr length
//System.arraycopy(xbuf.getBytesDirect(),offset,addr,0,addr.length);
data.setAddress(MemberImpl.getMember(xbuf.getBytesDirect(),offset,addrlen));
//offset += addr.length; //addr data
offset += addrlen;
int xsize = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //xsize length
System.arraycopy(xbuf.getBytesDirect(),offset,xbuf.getBytesDirect(),0,xsize);
xbuf.setLength(xsize);
data.message = xbuf;
return data;
}
代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource
/**
* Deserializes a ChannelData object from a byte array
* @param b byte[]
* @return ChannelData
*/
public static ChannelData getDataFromPackage(XByteBuffer xbuf) {
ChannelData data = new ChannelData(false);
int offset = 0;
data.setOptions(XByteBuffer.toInt(xbuf.getBytesDirect(),offset));
offset += 4; //options
data.setTimestamp(XByteBuffer.toLong(xbuf.getBytesDirect(),offset));
offset += 8; //timestamp
data.uniqueId = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
offset += 4; //uniqueId length
System.arraycopy(xbuf.getBytesDirect(),offset,data.uniqueId,0,data.uniqueId.length);
offset += data.uniqueId.length; //uniqueId data
//byte[] addr = new byte[XByteBuffer.toInt(xbuf.getBytesDirect(),offset)];
int addrlen = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //addr length
//System.arraycopy(xbuf.getBytesDirect(),offset,addr,0,addr.length);
data.setAddress(MemberImpl.getMember(xbuf.getBytesDirect(),offset,addrlen));
//offset += addr.length; //addr data
offset += addrlen;
int xsize = XByteBuffer.toInt(xbuf.getBytesDirect(),offset);
offset += 4; //xsize length
System.arraycopy(xbuf.getBytesDirect(),offset,xbuf.getBytesDirect(),0,xsize);
xbuf.setLength(xsize);
data.message = xbuf;
return data;
}
我想编写一个附加到整数数组的过程,但 Delphi IDE 给我编译时错误“不兼容类型”。这是我的代码: procedure appendToIntegerArray(var intArr : arr
在 Delphi 中,可以创建该类型的数组 var Arr: array[2..N] of MyType; 这是一个由 N - 1 元素组成的数组,索引从 2 到 N。 如果我们声明一个动态数组
我正在尝试使用以下函数来设置动态数组的长度,该数组是 var 参数。当我尝试编译代码时只有一个错误: [dcc64 错误] lolcode.dpr(138): E2008 不兼容类型 function
当然,即使我也能做到...... var testarray : array of string; setlength(testarray, 5); 但是如果我想变得聪明并有一个过程来通过引用传递
这个问题可能会也可能不会解决我的问题 - 但我希望了解 Delphi/Windows 如何以可能导致此问题的方式运行。 我有一个使用 3rd 方组件来加载 Outlook .msg 文件的应用程序。
在某些情况下,我需要设置动态数组的大小,然后用零填充它。 类似于: procedure SetLengthAndZero(VAR X; NewSize: Integer); begin SetL
今天我偶然发现了一个导致我的数组损坏的问题。这是一个可重现的测试用例: unit Unit40; interface type TVertex = record X, Y: Double;
我一直在阅读 RandomAccessFile 并了解可以通过 setLength 将文件末尾截断为比文件短的长度。我试图将文件的“结尾”复制到新文件并截断开头。 例如:我想删除文件的前 1300
在 stringbuilder 中修剪到一定长度。 我应该使用什么? StringBuilder sb = new StringBuilder("203253/62331066
我有这个代码: [[self.receivedData objectForKey:[NSNumber numberWithInt:connection.tag]] setLength:0]; 重复三次
这个问题已经有答案了: Clear contents of a file in Java using RandomAccessFile (2 个回答) 已关闭 9 年前。 我正在尝试清除用 java
我正在发出异步请求,并且在 [responseData setLength:0]; 上收到 EXC_BAD_ACCESS 代码是: - (void)connection:(NSURLConnectio
我有以下代码来生成字符串的所有可能的子字符串: import java.util.*; public class PlayString { public static void main(St
我需要创建一个包含记录对象数组的类,但尝试使用 SetLength 会引发访问冲突错误。 考虑以下带有水果的树对象示例。 type TFruit = record color: string;
尝试创建请求与 URL 的连接。 NSMutableData 实例(responseData)也会随之被调用。当连接开始接收响应时,将在 NSMutableData 实例上调用 setLength:N
代码说明 procedure TForm1.FormCreate(Sender: TObject); var Str: string; PStr: PChar; begin Str :=
我正在尝试调整作为参数传递的某个类的数组的大小,例如 procedure Resize(MyArray: Array of TObject); begin SetLength(MyArray, 1
我正在比较这两种初始化动态数组的方法之间的性能: Arr := TArray.Create(1, 2, 3, 4, 5); 和 SetLength(Arr, 5); Arr[0] := 1; Arr[
这是代码: package vu.co.kaiyin; import java.io.FileOutputStream; import java.io.RandomAccessFile; import
我有一个动态数组myArr。当我们使用 SetLength 时,myArr 的内存中存储了什么?是“00”吗?还是未定义?在本例中, SetLength 为 myArr 分配 16 字节内存。 myA
我是一名优秀的程序员,十分优秀!