mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 14:24:25 +02:00
read header of chunk quickly
This commit is contained in:
parent
71cf694c33
commit
b5c92c777a
@ -225,18 +225,6 @@ import java.util.List;
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static HeaderBlock readHeaderBlock(File file) throws IOException{
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
HeaderBlock headerBlock = readHeaderBlock(inputStream);
|
||||
inputStream.close();
|
||||
return headerBlock;
|
||||
}
|
||||
public static HeaderBlock readHeaderBlock(InputStream inputStream) throws IOException {
|
||||
HeaderBlock headerBlock=new HeaderBlock(ChunkType.NULL.ID);
|
||||
headerBlock.readBytes(inputStream);
|
||||
return headerBlock;
|
||||
}
|
||||
|
||||
public interface HeaderLoaded{
|
||||
void onChunkTypeLoaded(short type);
|
||||
void onHeaderSizeLoaded(int headerSize);
|
||||
|
@ -15,8 +15,14 @@
|
||||
*/
|
||||
package com.reandroid.arsc.header;
|
||||
|
||||
import com.reandroid.arsc.io.BlockReader;
|
||||
import com.reandroid.arsc.item.ByteArray;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class InfoHeader extends HeaderBlock{
|
||||
public InfoHeader(short type) {
|
||||
super(type);
|
||||
@ -31,4 +37,22 @@
|
||||
public int countBytes() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
||||
public static InfoHeader readHeaderBlock(File file) throws IOException {
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
InfoHeader infoHeader = readHeaderBlock(inputStream);
|
||||
inputStream.close();
|
||||
return infoHeader;
|
||||
}
|
||||
public static InfoHeader readHeaderBlock(InputStream inputStream) throws IOException {
|
||||
InfoHeader infoHeader=new InfoHeader();
|
||||
infoHeader.readBytes(inputStream);
|
||||
return infoHeader;
|
||||
}
|
||||
public static InfoHeader readHeaderBlock(BlockReader blockReader) throws IOException {
|
||||
InfoHeader infoHeader=new InfoHeader();
|
||||
infoHeader.readBytes(blockReader);
|
||||
return infoHeader;
|
||||
}
|
||||
}
|
||||
|
@ -293,10 +293,10 @@ import java.io.*;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
public static HeaderBlock readHeaderBlock(File file) throws IOException{
|
||||
return HeaderBlock.readHeaderBlock(file);
|
||||
public static InfoHeader readHeaderBlock(File file) throws IOException{
|
||||
return InfoHeader.readHeaderBlock(file);
|
||||
}
|
||||
public static HeaderBlock readHeaderBlock(InputStream inputStream) throws IOException{
|
||||
return HeaderBlock.readHeaderBlock(inputStream);
|
||||
public static InfoHeader readHeaderBlock(InputStream inputStream) throws IOException{
|
||||
return InfoHeader.readHeaderBlock(inputStream);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user