小编gio*_*.nl的帖子

Android 将字符串转换为ObjectInputStream

我正在尝试从字符串构造 ObjectInputStream 但出现 java.io.StreamCorruptedException:

我的代码:

public static final String PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7bO/38XhXYLJikoEEQ7s\naHKYcrrkD2Q+IWS6P0GOOvoX0rfRI6Hb30ETBE/ySzV6F9tpgtCbjU/w7tE8vmOy\nxQDwToUobbS+uZDi+F72PAY9NRKRogtY7YCwJuvAxNVmsTu9i/P/oA3qO3l0ge61\nZu3lMf4ujh969T9Dj0fjIdXQGewqk+ROB6UqoIEHTYi9wRdPlxDGnKTrORu5I5hH\n1xQfM0l49ME36G4u3Ipg5Y9Tqr1F8EL82GYeRoSX+xG+brQAdbjnQGrmrW/VFRkT\n9uL327vrRjiOit9yoTNtP3HYk1g5+Db7XdSNi+8KHZOQ3T2xcYFseXNnd7nIGj97\nBwIDAQAB\n-----END PUBLIC KEY-----";
public static final String PRIVATE_KEY_FILE = "C:/keys/private.key";


public static void test() {


 Log.d("DEBUG","Original Text: ");
try {

  final String originalText = "top secret text";
  ObjectInputStream inputStream = null;

  InputStream is = new ByteArrayInputStream(PUBLIC_KEY.getBytes());


  //Log.d("DEBUG","Original Text:3 " + convertStreamToString(is));
  // Encrypt the string using the public key
  inputStream = new ObjectInputStream(is);
  final PublicKey publicKey = (PublicKey) inputStream.readObject();
  final byte[] cipherText = encrypt(originalText, publicKey);

  // Decrypt …
Run Code Online (Sandbox Code Playgroud)

java string android objectinputstream

5
推荐指数
1
解决办法
4391
查看次数

从设备崩溃日志调试iPhone应用程序

我正在尝试调试难以在我的iPhone应用程序上重现崩溃.我到目前为止唯一的信息是来自我客户设备的以下日志:

Incident Identifier: 7A3417A-4F27-44E3-97A3-AF811A79C88E
CrashReporter Key:   13d8ee7a1052506be1ae7b4bbcb3439d1c86df85
Hardware Model:      iPhone4,1
OS Version:          iPhone OS 6.0 (10A403)
Kernel Version:      Darwin Kernel Version 13.0.0: Sun Aug 19 00:28:05 PDT 2012; root:xnu-2107.2.33~4/RELEASE_ARM_S5L8940X
Date:                2012-10-24 08:11:29 +0200
Time since snapshot: 7156 ms

Free pages:        793
Active pages:      3323
Inactive pages:    2043
Throttled pages:   88283
Purgeable pages:   144
Wired pages:       33372
Largest process:   NLinBusiness

Processes
     Name                                           rpages       recent_max       [reason]          (state)

             lsd           172              172         [vm]         (daemon) (idle)
     MobilePhone          1015             1015         [vm]         (resume) (continuous)
            tccd           170              170 …

iphone logging ios

4
推荐指数
1
解决办法
7519
查看次数

textField resignFirstResponder 消失 UITableView 标题

我有一个UITextField内部 aUIView用作 a 的 tableHeaderView UITableView

当我打电话resignFirstRespondertextField,以消除键盘,整个tableHeaderView消失。当我尝试在键盘启动时重新加载 tableview 的数据时,也会发生同样的情况。

任何想法为什么?

编辑:示例代码

UITableViewCell *header = [self.tableView dequeueReusableCellWithIdentifier:@"mapViewCell"];
UITextField *searchField = [header viewWithTag:6];
searchField.delegate = self;
self.tableView.tableHeaderView = header;
Run Code Online (Sandbox Code Playgroud)

并在文本字段的委托方法中:

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [searchField resignFirstResponder];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

键盘被解除,但整个tableHeaderView消失(变成白色)

uitableview uitextfield ios resignfirstresponder

4
推荐指数
1
解决办法
1037
查看次数