public static String readTag(KyoroFile vFile) throws IOException { byte[] header = new byte[128]; long pointer = vFile.getFilePointer(); vFile.read(header); int sep = 0; for (int i = 0; i < header.length; i++) { if (':' == header[i]) { sep = i; break; } } String sizeAsS = new String(header, 3, sep - 3); // android.util.Log.v("kiyo","##NNNN#"+new String(header,0,header.length)); long size = Long.parseLong(sizeAsS); vFile.seek(pointer + sep + 1); byte[] body = new byte[(int) size]; vFile.read(body); return new String(body, "utf8"); }
public static void saveF(KyoroFile input, KyoroFile output, long begin, long end) throws IOException { byte[] buffer = new byte[1024]; long len = 0; int writed = 0; do { len = end - begin - writed; if (len >= 1024) { len = 1024; } if (len <= 0) { break; } len = input.read(buffer, (int) len); if (len <= 0) { break; } writed += len; output.addChunk(buffer, 0, (int) len); if (writed >= end - begin) { break; } } while (true); }