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


Java BinaryPropertyListWriter类代码示例

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


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

示例1: sendMessage

import com.dd.plist.BinaryPropertyListWriter; //导入依赖的package包/类
@Override
public void sendMessage(NSDictionary message) throws IOException {
  byte[] messageBytes = BinaryPropertyListWriter.writeToArray(message);
  byte[] lengthBytes = Ints.toByteArray(messageBytes.length);
  socketOut.write(lengthBytes);
  socketOut.write(messageBytes);
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:8,代码来源:BinaryPlistSocket.java

示例2: testReceiveMessage

import com.dd.plist.BinaryPropertyListWriter; //导入依赖的package包/类
@Test
public void testReceiveMessage() throws IOException {
  NSDictionary inputMessage = new NSDictionary();
  inputMessage.put("goodbye", "world");
  byte[] messageBytes = BinaryPropertyListWriter.writeToArray(inputMessage);
  byte[] lengthBytes = Ints.toByteArray(messageBytes.length);
  byte[] inputBytes = new byte[messageBytes.length + 4];
  System.arraycopy(lengthBytes, 0, inputBytes, 0, 4);
  System.arraycopy(messageBytes, 0, inputBytes, 4, messageBytes.length);

  FakeSocket fakeSocket = new FakeSocket(inputBytes);
  try (InspectorSocket socket = new BinaryPlistSocket(fakeSocket)) {
    assertThat(socket.receiveMessage().get()).isEqualTo(inputMessage);
  }
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:16,代码来源:BinaryPlistSocketTest.java

示例3: testReceiveEOF

import com.dd.plist.BinaryPropertyListWriter; //导入依赖的package包/类
@Test
public void testReceiveEOF() throws IOException {
  NSDictionary inputMessage = new NSDictionary();
  inputMessage.put("goodbye", "world");
  byte[] messageBytes = BinaryPropertyListWriter.writeToArray(inputMessage);
  byte[] lengthBytes = Ints.toByteArray(messageBytes.length + 1);
  byte[] inputBytes = new byte[messageBytes.length + 4];
  System.arraycopy(lengthBytes, 0, inputBytes, 0, 4);
  System.arraycopy(messageBytes, 0, inputBytes, 4, messageBytes.length);

  FakeSocket fakeSocket = new FakeSocket(inputBytes);
  try (InspectorSocket socket = new BinaryPlistSocket(fakeSocket)) {
    assertThat(socket.receiveMessage().isPresent()).isFalse();
  }
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:16,代码来源:BinaryPlistSocketTest.java

示例4: writePlist

import com.dd.plist.BinaryPropertyListWriter; //导入依赖的package包/类
/**
 * Writes the results of a merge operation to a binary plist file.
 * @param plistPath the path of the plist to write in binary format
 */
public PlistMerging writePlist(Path plistPath) throws IOException {
  try (OutputStream out = Files.newOutputStream(plistPath)) {
    BinaryPropertyListWriter.write(out, merged);
  }
  return this;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:11,代码来源:PlistMerging.java


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