Şimdi Ara

Reading large files from NSInputstream is not working in iOS

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
1
Cevap
0
Favori
130
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • I am working on iOS app, I am trying to read large Image file more than 300KB from NSInputStream. But i'm getting only upto 300KB. Other data are missing. I am searching solutions of this query on few ios developer forum if you have answer of my query please help me. i'm waiting for your valuable answer. Check below code
    NSStreamEventsHasBytesAvailable:


    - (void)readAllData { 

    if ( _readData == nil) {
    _readData = [[NSMutableData data] retain];
    }

    while ([[ _session inputStream] hasBytesAvailable])
    {
    unsigned int bytesRead = 0;
    bytesRead = [[ _session inputStream] read:buf maxLength: @"1024"];

    if (bytesRead) {

    NSMutableString * _string = [NSMutableString stringWithString:@""];
    for (int i = 0; i < _readData.length; i++) {
    unsigned char _byte;
    [_readData getBytes:&_byte range:NSMakeRange(i, 1)];
    i f ( _byte >= 32 && _byte < 127) {
    [ _string appendFormat:@"%c", _byte];
    } else {
    [ _string appendFormat:@"[%d]", _byte];
    }
    }

    [ _readData appendBytes:(const void *)buf length:bytesRead];

    }

    }

    NSString *string=[NSString stringWithFormat:@"%d", _readData.length];
    UIAlertView *sesView = [[UIAlertView alloc] initWithTitle:@"readDatalength"
    message:string
    delegate:self
    cancelButtonTitle:nil otherButtonTitles:@"OK" , nil];
    [sesView show];
    }







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.