当前位置: 首页>>代码示例>>Java>>正文


Java Marshalling.createByteInput方法代码示例

本文整理汇总了Java中org.jboss.marshalling.Marshalling.createByteInput方法的典型用法代码示例。如果您正苦于以下问题:Java Marshalling.createByteInput方法的具体用法?Java Marshalling.createByteInput怎么用?Java Marshalling.createByteInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.marshalling.Marshalling的用法示例。


在下文中一共展示了Marshalling.createByteInput方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEqualBuffer

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
@Test
public void testEqualBuffer() throws Exception {
    final byte[] content = "1234567890".getBytes(StandardCharsets.UTF_8);

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

    byteOutput.write(content);
    byteOutput.flush();

    final byte[] chunked = byteArrayOutputStream.toByteArray();

    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
    final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
    byte[] result = new byte[content.length];
    byteInput.read(result);
    byteInput.close();

    Assert.assertArrayEquals(content, result);
    Assert.assertEquals(-1, byteInput.read());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:ChunkyByteInputOutputTest.java

示例2: testMultiChunk

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
@Test
public void testMultiChunk() throws Exception {
    final byte[] content = "12345678901234567890123456789012345678901234567890".getBytes(StandardCharsets.UTF_8);

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

    byteOutput.write(content);
    byteOutput.flush();

    final byte[] chunked = byteArrayOutputStream.toByteArray();

    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
    final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
    byte[] result = new byte[content.length];
    byteInput.read(result);
    byteInput.close();

    Assert.assertArrayEquals(content, result);
    Assert.assertEquals(-1, byteInput.read());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:ChunkyByteInputOutputTest.java

示例3: testRemainingBytes

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
@Test
public void testRemainingBytes() throws Exception {
    final byte[] content = "1234567890123456789012345678901234567890123".getBytes(StandardCharsets.UTF_8);

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

    byteOutput.write(content);
    byteOutput.flush();

    final byte[] chunked = byteArrayOutputStream.toByteArray();

    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
    final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
    byte[] result = new byte[content.length];
    byteInput.read(result);
    byteInput.close();

    Assert.assertArrayEquals(content, result);
    Assert.assertEquals(-1, byteInput.read());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:ChunkyByteInputOutputTest.java

示例4: testIncompleteRead

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
@Test
public void testIncompleteRead() throws Exception {
    final byte[] content = "1234567890123456789012345678901234567890123".getBytes(StandardCharsets.UTF_8);

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

    byteOutput.write(content);
    byteOutput.flush();

    final byte[] chunked = byteArrayOutputStream.toByteArray();

    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
    final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
    int readLength = content.length - 15;
    byte[] result = new byte[readLength];
    byteInput.read(result);
    byteInput.close();

    byte[] expected = new byte[readLength];
    System.arraycopy(content, 0, expected, 0, readLength);

    Assert.assertArrayEquals(expected, result);
    Assert.assertEquals(-1, byteInput.read());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:ChunkyByteInputOutputTest.java

示例5: testOffsetRead

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
@Test
public void testOffsetRead() throws Exception {
    final byte[] content = "1234567890123456789012345678901234567890123".getBytes(StandardCharsets.UTF_8);

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

    byteOutput.write(content);
    byteOutput.flush();

    final byte[] chunked = byteArrayOutputStream.toByteArray();

    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
    final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));

    int readLength = 5;
    byte[] result = new byte[content.length];
    byteInput.read(result, content.length - 6, readLength);
    byteInput.close();

    byte[] expected = new byte[content.length];
    System.arraycopy(content, 0, expected, content.length - 6, readLength);

    Assert.assertArrayEquals(expected, result);
    Assert.assertEquals(-1, byteInput.read());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:ChunkyByteInputOutputTest.java

示例6: ChunkyByteInput

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
public ChunkyByteInput(final InputStream inputStream) {
    input = Marshalling.createByteInput(inputStream);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:4,代码来源:ChunkyByteInput.java

示例7: SimpleByteDataInput

import org.jboss.marshalling.Marshalling; //导入方法依赖的package包/类
public SimpleByteDataInput(final InputStream inputStream) {
    this.input = new SimpleDataInput(Marshalling.createByteInput(inputStream));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:4,代码来源:SimpleByteDataInput.java


注:本文中的org.jboss.marshalling.Marshalling.createByteInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。