package zeta.tool;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import zeta.util.StreamUtils;
public class CountLines {
private final static int DEADLINE_IN_DAYS = 5;
public static void main(String[] args) {
countLines();
}
static String candidates = "21821263400,21821763300,21823962800,21824462700,21824962600,21825462500,21825962400,21826462300,21826962200,21827462100,21827962000,21828461900,21828961800,21829461700,21829961600,21830461500,21830961400,21831461300,21831961200,21832461100,21832961000,21833460900,21833960800,21834460700,21834960600,21835460500,21835960400,21836460300,21836960200,21837460100,21837960000,21838459900,21885150100,21889949100,21890948900,21931539800,21932039700,21941437700,21945937200,21986529300,21992028200,21993527900,22027420900,22027920800,22028420700,22028920600,22029420500,22031820000,22034019500,22035219200,22035719100,22067412900,22068412700,22069412500,22069912400,22070912200,22071912000,22072411900,22074611500,22075611300,22077810800,22078310700,22103605600,22104105500,22105105300,22106105100,22107104900,22107604800,22108104700,22108604600,22110304200,22111304000,22111803900,22141598300,22142098200,22144097800,22147097400,22150596800,22153596200,22154096100,22177891200,22178591000,22182290300,22183490000,22185789500,22186789300,22211284200,22212284000,22212783900,22215083400,22216583100,22244077600,22246477000,22246976900,22281470700,22282270500,22283770200,22284270100,22285769800,22286269700,22307265300,22307765200,22309264900,22314663800,22315163700,22339458800,22341158400,22341658300,22342658100,22345857500,22346357400,22370153100,22375852400,22378851700,22380051400,22381751000,22382250900,22391249600,22391749500,22408845900,22409345800,22411345400,22418044100,22418544000,22419543800,22420043700,22425242700,22425742600,22446738300,22451737200,22452237100,22452737000,22453936700,22454436600,22457936000,22458435900,22478231800,22482431200,22483431000,22486130500,22486630400,22490629700,22492629300,22510725500,22517924500,22520624000,22521823700,22522323600,22522823500,22525822900,22526322800,22544619000,22545118900,22549118100,22549618000,22552617500,22553117400,22554117200,22558516200,22559016100,22575612800,22576112700,22587010400,22590009800,22590509700,22611005800,22618204400,22619204200,22623203400,22625003000,22643799500,22644299400,22655597200,22658096700,22658596600,22671693800,22672193700,22682391800,22682891700,22683391600,22683891500,22685691100,22689090300,22689590200,22710086500,22710586400,22716585200,22717085100,22719484500,22720784200,22721284100,22722283900,22722783800,22741380000,22743379700,22744579400,22749978300,22751278000,22751777900,22752977600,22754477300,22754977200,22756476900,22756976800,22782672000,22784471600,22785671300,22787671000,22788170900,22788670800,22789670600,22810466400,22813165800,22813665700,22816665200,22818165000,22820164700,22823164100,22826163700,22826863500,22827363400,22830862700,22831362600,22847659100,22849358800,22849858700,22850858500,22851358400,22851858300,22853358000,22855157600,22860056500,22860556400,22861056300,22861556200,22862056100,22863055900,22863555800,22879652600,22884851600,22887251000,22889050600,22891550100,22896549500,22899049100,22900048900,22901048700,22918045300,22923044700,22927543700,22929043400,22929543300,22931542900,22932042800,22932742600,22934242300,22935742000,22958437800,22960437400,22961937100,22964436600,22965736300,22967236000,22968235800,22970135300,22970635200,22971135100,22993230600,22993730500,22995230200,22997929600,22999929200,23001928800,23002428700,23005128200,23006128000,23007127800,23007627700,23009827200,23010327100,23025924000,23026923800,23035122500,23038621900,23040121600,23042121200,23043620900,23044120800,23061817300,23062317200,23065316700,23069615800,23070615600,23073115200,23076314500,23077314300,23079314000,23081713400,23082213300,23096410500,23098110200,23098610100,23100109800,23105508600,23107508200,23108008100,23110007700,23112207200,23115606500,23116106400,23130003500,23132203100,23132703000,23136502200,23138501800,23139001700,23139501600,23141701100,23164797100,23169796100,23174395100,23176394800,23177394600,23177894500,23181093900,23182593600,23186292900,23186792800,23193991300,23197990500,23204189300,23211288000,23211987800,23212487700,23215387100,23216886800,23221285800,23221785700,23239781800,23242981100,23247679800,23249179500,23255078300,23259977300,23260477200,23262476900,23263476700,23266176100,23273375100,23274874800,23278574000,23279073900,23292770800,23297169900,23303368500,23307567700,23309467200,23309967100,23311166800,23313166300,23315665800,23317865400,23318365300,23319565000,23320064900,23328063600,23328563500,23333262800,23349959800,23355758500,23358557900,23362356900,23369055700,23370555400,23375254500,23378253900,23380253400,23382253000,23382752900,23384752600,23396650100,23401549100,23403548500,23412046800,23415546100,23420545000,23421544800,23423544500,23424544300,23426943600,23427443500,23428943200,23440141200,23444340300,23446639800,23454838200,23455838000,23456337900,23458537400,23461536900,23462536700,23466036100,23467035900,23469235500,23470735200,23471235100,23474534400,23475534200,23477033900,23487031800,23490731100,23492730800,23496430200,23499629500,23509128200,23514227200,23516726700,23518426300,23518926200,23520925900,23521425800,23524625100,23526024800,23527024600,23533923100,23540921800,23544921000,23545920800,23547320400,23549320000,23554019200,23560417900,23564717100,23565716900,23566216800,23566716700,23568216400,23570615900,23577514500,23583613100,23590911700,23591611500,23594610900,23596610600,23598110300,23601009700,23601509600,23603509200,23604509000,23607008400,23607508300,23625105100,23629804200,23632203800,23633203600,23634203400,23637702600,23639602100,23640102000,23641301700,23642301500,23651000000,23652499700,23653999400,23654999200,23655499100,23665997000,23676195400,23678395000,23685493700,23689792900,23691292600,23698591300,23699591100,23700091000,23712088500,23720086900,23721586600,23722086500,23727985300,23735983600,23736483500,23736983400,23737483300,23737983200,23753380300,23758879200,23760379000,23766277900,23768777400,23769477200,23769977100,23771976800,23772476700,23779775100,23781074800,23797471600,23807870200,23809069900,23809569800,23810069700,23816968300,23830166200,23834265300,23834765200,23840763900,23841263800,23841763700,23842963400,23846962700,23850662200,23865659400,23870058400,23872757800,23875157200,23881355900,23883355500,23888554300,23898352100,23912948900,23917247900,23921847000,23922346900,23925846100,23927345800,23934244000,23934743900,23945242100,23963638400,23968937200,23970936700,23974935900,23975935700,23981934600,23982934400,24008328900,24015427500,24015927400,24017127100,24023025700,24023525600,24024025500,24028924500,24029424400,24036023200,24036523100,24044021800,24044521700,24046021400,24050020700,24053520000,24054319800,24066817200,24072716200,24073216100,24074715800,24081014300,24082514100,24085513500,24086013400,24089012800,24090012600,24090512500,24093012000,24094011800,24097011100,24098010900,24099010700,24100710400,24101410200,24108308900,24114707700,24115207600,24124205800,24124905600,24127605100,24129604700,24130604500,24134703700,24135703500,24142402300,24144701800,24145701600,24151700500,24169697000,24170196900,24172196500,24173396300,24173896200,24184094600,24184594500,24190993200,24195392400,24200691300,24209889700,24212789200,24216788600,24218788200,24219288100,24220787800,24221287700,24223287300,24223787200,24226586600,24227286400,24228286200,24232985100,24233485000,24239083900,24241483500,24244282900,24250681500,24254980600,24259879800,24261879400,24263279000,24265978500,24267478200,24271977400,24272777200,24273277100,24277276500,24279076100,24281275600,24287774400,24291973700,24298772200,24305671000,24314369400,24316069000,24316568900,24318068600,24324267300,24324767200,24326066900,24326566800,24327766500,24332265500,24335964700,24340663900,24349662300,24359160500,24363159600,24363659500,24365359200,24367358800,24377656800,24383155900,24386655200,24400752400,24401252300,24401752200,24407651100,24408151000,24411150400,24411650300,24421248300,24425947300,24433345900,24455441500,24458641000,24459140900,24463840000,24465039700,24471738500,24472438300,24480936400,24482636000,24490534300,24499732200,24507530500,24511029800,24511529700,24518228200,24518728100,24523427200,24530625600,24532125300,24543323100,24556520100,24558519700,24559519500";
static void countLines() {
File file = new File(ConstantProperties.FINAL_DIR + "/1");
File[] list = file.listFiles();
if (list != null) {
for (int i = 0; i < list.length; ++i) {
String s = list[i].getName();
if (s.endsWith(".zip")) {
int idx = 11;
final int l = s.length();
while (++idx < l && Character.isDigit(s.charAt(idx)));
if (candidates.indexOf(s.substring(11, idx)) >= 0) {
ZipInputStream zip = null;
try {
zip = new ZipInputStream(new FileInputStream(list[i]));
boolean found = false;
for (int k = 0; k < 2; ++k) {
ZipEntry zEntry = zip.getNextEntry();
if (zEntry.getName().endsWith(".log")) {
byte[] buffer = new byte[1];
int n = zip.read(buffer);
found = (n <= 0);
}
}
if (found) {
zip.close();
zip = null;
zip = new ZipInputStream(new FileInputStream(list[i]));
for (int k = 0; k < 2; ++k) {
ZipEntry zEntry = zip.getNextEntry();
if (zEntry.getName().endsWith(".txt")) {
int count = 0;
byte[] buffer = new byte[64 * 1024];
while (true) {
int n = zip.read(buffer);
if (n <= 0) break;
for (int j = 0; j < n; ++j) {
if (buffer[j] == (byte)'\n') ++count;
}
}
System.out.println(zEntry.getName() + ':' + count);
}
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
StreamUtils.close(zip);
}
}
}
}
}
}
}