1. 程式人生 > >剖析Picasso載入壓縮本地圖片流程(解決Android 5.0部分機型無法載入本地圖片的問題)

剖析Picasso載入壓縮本地圖片流程(解決Android 5.0部分機型無法載入本地圖片的問題)

public int read() throws IOException {
   
if (!this.allowExpire && this.offset + 1L > this.limit) {
       
this .setLimit(this.limit + ( long)this .limitIncrement);
   
}

   
int result = this.in.read() ;
    if
(result != - 1) {
        ++
this .offset;
   
}

   
return result;
}

public int
read(byte [] buffer) throws IOException {
   
if (!this.allowExpire && this.offset + (long )buffer.length > this.limit) {
       
this .setLimit(this.offset + ( long)buffer.length + (long)this .limitIncrement);
   
}

   
int count = this.in.read(buffer) ;
    if
(count != - 1) {
       
this .offset += (long)count ;
   
}

   
return count;
}

public int read(byte [] buffer, int offset , int length) throws IOException {
   
if (!this.allowExpire && this.offset + (long )length > this.limit) {
       
this .setLimit(this.offset + ( long)length + (long)this .limitIncrement)
;
   
}

   
int count = this.in.read(buffer , offset, length);
    if
(count != - 1) {
       
this .offset += (long)count ;
   
}

   
return count;