當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。