mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 22:34:24 +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();
|
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{
|
public interface HeaderLoaded{
|
||||||
void onChunkTypeLoaded(short type);
|
void onChunkTypeLoaded(short type);
|
||||||
void onHeaderSizeLoaded(int headerSize);
|
void onHeaderSizeLoaded(int headerSize);
|
||||||
|
@ -15,8 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.reandroid.arsc.header;
|
package com.reandroid.arsc.header;
|
||||||
|
|
||||||
|
import com.reandroid.arsc.io.BlockReader;
|
||||||
import com.reandroid.arsc.item.ByteArray;
|
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 class InfoHeader extends HeaderBlock{
|
||||||
public InfoHeader(short type) {
|
public InfoHeader(short type) {
|
||||||
super(type);
|
super(type);
|
||||||
@ -31,4 +37,22 @@
|
|||||||
public int countBytes() {
|
public int countBytes() {
|
||||||
return 8;
|
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;
|
return buff;
|
||||||
}
|
}
|
||||||
public static HeaderBlock readHeaderBlock(File file) throws IOException{
|
public static InfoHeader readHeaderBlock(File file) throws IOException{
|
||||||
return HeaderBlock.readHeaderBlock(file);
|
return InfoHeader.readHeaderBlock(file);
|
||||||
}
|
}
|
||||||
public static HeaderBlock readHeaderBlock(InputStream inputStream) throws IOException{
|
public static InfoHeader readHeaderBlock(InputStream inputStream) throws IOException{
|
||||||
return HeaderBlock.readHeaderBlock(inputStream);
|
return InfoHeader.readHeaderBlock(inputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user