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


Java ByteArray类代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.ByteArray的典型用法代码示例。如果您正苦于以下问题:Java ByteArray类的具体用法?Java ByteArray怎么用?Java ByteArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: write

import com.badlogic.gdx.utils.ByteArray; //导入依赖的package包/类
@Override
public void write(Kryo kryo, Output output, ByteArray array) {
    output.writeVarInt(array.size, true);
    output.writeBoolean(array.ordered);
    for (int i = 0; i < array.size; i++) {
        output.writeByte(array.get(i));
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:9,代码来源:ByteArraySerializer.java

示例2: read

import com.badlogic.gdx.utils.ByteArray; //导入依赖的package包/类
@Override
public ByteArray read(Kryo kryo, Input input, Class<ByteArray> type) {
    int length = input.readVarInt(true);
    boolean ordered = input.readBoolean();
    ByteArray array = new ByteArray(ordered, length);
    for (int i = 0; i < length; i++) {
        array.add(input.readByte());
    }
    return array;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:11,代码来源:ByteArraySerializer.java

示例3: getRootDir

import com.badlogic.gdx.utils.ByteArray; //导入依赖的package包/类
@Test
void getRootDir() throws InterruptedException {

    if (EXCLUDE_FROM_TRAVIS.VALUE) return;

    assertThat("Connection must be established", clint.connect());
    assertThat("Connection must be established", clint.connect());
    ServerFile root = clint.getFiles();
    ServerFileTest.assertRecursiveDir(workpath, root, workpath.parent().path());


    FileHandle file = workpath.child("lang/de/strings.ini");
    String sendPath = "sendTest/de";
    ServerFile serverFile = new ServerFile("", sendPath, true);
    FileHandle targetFile = workpath.child(sendPath).child("strings.ini");

    if (targetFile.exists()) {
        // delete test file
        targetFile.parent().parent().deleteDirectory();
        assertThat("transmitted File must delete", !targetFile.exists());
    }

    Thread.sleep(100);

    ArrayList<File> fileList = new ArrayList<>();
    fileList.add(file.file());

    try {
        assertThat("sendFiles must return true", clint.sendFiles(null, serverFile, root, fileList));
    } catch (Exception e) {
        e.printStackTrace();
    }

    Thread.sleep(100);

    assertThat("transmitted File must exist", targetFile.exists());
    assertThat("File.length must equals", targetFile.length() == file.length());

    ByteArray a1 = new ByteArray(targetFile.readBytes());
    ByteArray a2 = new ByteArray(file.readBytes());


    assertThat("File Content must equals", a1.equals(a2));


    // delete test file
    targetFile.parent().parent().deleteDirectory();
    assertThat("transmitted File must delete", !targetFile.exists());

    Thread.sleep(100);
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:52,代码来源:FileBrowserTest.java


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