mirror of
https://github.com/google/brotli.git
synced 2026-07-11 19:28:16 +00:00
84 lines
237 KiB
Java
84 lines
237 KiB
Java
|
|
/* Copyright 2015 Google Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
Distributed under MIT license.
|
||
|
|
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
||
|
|
*/
|
||
|
|
|
||
|
|
package org.brotli.dec;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Collection of static dictionary words.
|
||
|
|
*
|
||
|
|
* <p>Dictionary content is loaded from binary resource when {@link #getData()} is executed for the
|
||
|
|
* first time. Consequently, it saves memory and CPU in case dictionary is not required.
|
||
|
|
*
|
||
|
|
* <p>One possible drawback is that multiple threads that need dictionary data may be blocked (only
|
||
|
|
* once in each classworld). To avoid this, it is enough to call {@link #getData()} proactively.
|
||
|
|
*/
|
||
|
|
final class Dictionary {
|
||
|
|
/**
|
||
|
|
* "Initialization-on-demand holder idiom" implementation.
|
||
|
|
*
|
||
|
|
* <p>This static class definition is not initialized until the JVM determines that it must be
|
||
|
|
* executed (when the static method {@link #getData()} is invoked).
|
||
|
|
*/
|
||
|
|
private static class DataHolder0 {
|
||
|
|
private static String getData() {
|
||
|
|
return "timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0\"</a>stopelseliestourpack.gifpastcss?graymean>rideshotlatesaidroadvar feeljohnrickportfast'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml\"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid=\"sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$(\"#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS\"agedgreyGET\"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:\u00E5*/\r\n 100hall.\n\nA7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,\r\n\r\ncoolfeet.php<br>ericmostguidbelldeschairmathatom/imgRluckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px''););\">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarm\u00E2\u0080\u0099sboys[0].');\"POSTbearkids);}}marytend(UK)quadzh:\u00E6-siz----prop');\rliftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene \u00E2\u0080\u0094softrometillross<h3>pourfadepink<tr>mini)|!(minezh:\u00E8barshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json', 'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:\u00E4'));puremageparatonebond:37Z_of_']);000,zh:\u00E7tankyardbowlbush:56ZJava30px\n|}\n%C3%:34ZjeffEXPIcashvisagolfsnowzh:\u00E9quer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;\n}\nexit:35Zvarsbeat'});diet999;anne}}</[i].Langkm\u00C2\u00B2wiretoysaddssealalex;\n\t}echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$('.50pxPh.Dmiscalanloandeskmileryanunixdisc);}\ndustclip).\n\n70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}\r\nHEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-\n!002)ndow[1];[];\nLog salt\r\n\t\tbangtrimbath){\r\n00px\n});ko:\u00ECfeesad>\rs:// [];tollplug(){\n{\r\n .js'200pdualboat.JPG);\n}quot);\n\n');\n\r\n}\r201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comom\u00C3\u00A1sesteestaperotodohacecadaa\u00C3\u00B1obiend\u00C3\u00ADaas\u00C3\u00ADvidacasootroforosolootracualdijosidograntipotemadebealgoqu\u00C3\u00A9estonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasi\u00D0\u00B7\u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D0\u00BE\u00D0\u00BC\u00D1\u0080\u00D0\u00B0\u00D1\u0080\u00D1\u0083\u00D1\u0082\u00D0\u00B0\u00D0\u
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private static class DataHolder1 {
|
||
|
|
private static String getData() {
|
||
|
|
return "japanesecodebasebutton\">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth=\"2lazyloadnovemberused in height=\"cript\">\n </<tr><td height:2/productcountry include footer\" <!-- title\"></jquery.</form>\n(\u00E7\u00AE\u0080\u00E4\u00BD\u0093)(\u00E7\u00B9\u0081\u00E9\u00AB\u0094)hrvatskiitalianorom\u00C3\u00A2n\u00C4\u0083t\u00C3\u00BCrk\u00C3\u00A7e\u00D8\u00A7\u00D8\u00B1\u00D8\u00AF\u00D9\u0088tambi\u00C3\u00A9nnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespu\u00C3\u00A9sdeportesproyectoproductop\u00C3\u00BAbliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopini\u00C3\u00B3nimprimirmientrasam\u00C3\u00A9ricavendedorsociedadrespectorealizarregistropalabrasinter\u00C3\u00A9sentoncesespecialmiembrosrealidadc\u00C3\u00B3rdobazaragozap\u00C3\u00A1ginassocialesbloqueargesti\u00C3\u00B3nalquilersistemascienciascompletoversi\u00C3\u00B3ncompletaestudiosp\u00C3\u00BAblicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayor\u00C3\u00ADaalemaniafunci\u00C3\u00B3n\u00C3\u00BAltimoshaciendoaquellosedici\u00C3\u00B3nfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratoj\u00C3\u00B3venesdistritot\u00C3\u00A9cnicaconjuntoenerg\u00C3\u00ADatrabajarasturiasrecienteutilizarbolet\u00C3\u00ADnsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallapr\u00C3\u00B3ximoalmer\u00C3\u00ADaanimalesqui\u00C3\u00A9nescoraz\u00C3\u00B3nsecci\u00C3\u00B3nbuscandoopcionesexteriorconceptotodav\u00C3\u00ADagaler\u00C3\u00ADaescribirmedicinalicenciaconsultaaspectoscr\u00C3\u00ADticad\u00C3\u00B3laresjusticiadeber\u00C3\u00A1nper\u00C3\u00ADodonecesitamantenerpeque\u00C3\u00B1orecibidatribunaltenerifecanci\u00C3\u00B3ncanariasdescargadiversosmallorcarequieret\u00C3\u00A9cnicodeber\u00C3\u00ADaviviendafinanzasadelantefuncionaconsejosdif\u00C3\u00ADcilciudadesantiguasavanzadat\u00C3\u00A9rminounidadess\u00C3\u00A1nchezcampa\u00C3\u00B1asoftonicrevistascontienesectoresmomentosfacultadcr\u00C3\u00A9ditodiversassupuestofactoressegundospeque\u00C3\u00B1a\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D0\u00B0\u00D0\u00B5\u00D1\u0081\u00D0\u00BB\u00D0\u00B8\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00BE\u00D0\u00B1\u00D1\u008B\u00D1\u0082\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D0\u0095\u00D1\u0081\u00D0\u00BB\u00D0\u00B8\u00D1\u0082\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D1\u008F\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D1\u0085\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00B9\u00D0\u00B4\u00D0\u00B0\u00D0\u00B6\u00D0\u00B5\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00B8\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D1\u0083\u00D0\u00B4\u00D0\u00B5\u00D0\u00BD\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D1\u0082\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D0\u00B5\u00D0\u00B1\u00D1\u008F\u00D0\u00BE\u00D0\u00B4\u00D0\u00B8\u00D0\u00BD\u00D1\u0081\u00D0\u00B5\u00D0\u00B1\u00D0\u00B5\u00D0\u00BD\u00D0\u00B0\u00D0\u00B4\u00D0\u00BE\u00D1\u0081\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D1\u0084\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00BD\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B8\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B9\u00D0\u00B8\u00D0\u00B3\u00D1\u0080\u00D1\u008B\u00D1\u0082\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00BC\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D1\u008E\u00D0\u00BB\u00D0\u00B8\u00D1\u0088\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00B8\u00D1\u0085\u00D0\u00BF\u00D0\u00BE\u00D0\u00BA\u00D0\u00B0\u00D0\u00B4\u00D0\u00BD\u00D0\u00B5\u00D0\u00B9\u00D0\u00B4\u00D0\u00BE\u00D0\u00BC\u00D0\u00B0\u00D0\u00BC\u00D0\u00B8\u00D1\u0080\u00D0\u00B0\u00D0\u00BB\u00D0\u00B8\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D1\u0083\u00D1\u0085\u00D0\u00BE\u00D1\u0082\u00D1\u008F\u00D0\u00B4\u00D0\u00B2\u00D1\u0083\
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private static class DataHolder2 {
|
||
|
|
private static String getData() {
|
||
|
|
return "consistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\\s+|\\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers\t<link rel=\"provided thethe story ofcompetitionsenglish (UK)english (US)\u00D0\u009C\u00D0\u00BE\u00D0\u00BD\u00D0\u00B3\u00D0\u00BE\u00D0\u00BB\u00D0\u00A1\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D1\u0081\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D1\u0081\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00BE\u00D9\u0084\u00D8\u00B9\u00D8\u00B1\u00D8\u00A8\u00D9\u008A\u00D8\u00A9\u00E6\u00AD\u00A3\u00E9\u00AB\u0094\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E7\u00AE\u0080\u00E4\u00BD\u0093\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E7\u00B9\u0081\u00E4\u00BD\u0093\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E6\u009C\u0089\u00E9\u0099\u0090\u00E5\u0085\u00AC\u00E5\u008F\u00B8\u00E4\u00BA\u00BA\u00E6\u00B0\u0091\u00E6\u0094\u00BF\u00E5\u00BA\u009C\u00E9\u0098\u00BF\u00E9\u0087\u008C\u00E5\u00B7\u00B4\u00E5\u00B7\u00B4\u00E7\u00A4\u00BE\u00E4\u00BC\u009A\u00E4\u00B8\u00BB\u00E4\u00B9\u0089\u00E6\u0093\u008D\u00E4\u00BD\u009C\u00E7\u00B3\u00BB\u00E7\u00BB\u009F\u00E6\u0094\u00BF\u00E7\u00AD\u0096\u00E6\u00B3\u0095\u00E8\u00A7\u0084informaci\u00C3\u00B3nherramientaselectr\u00C3\u00B3nicodescripci\u00C3\u00B3nclasificadosconocimientopublicaci\u00C3\u00B3nrelacionadasinform\u00C3\u00A1ticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecont\u00C3\u00A1ctenoshabitacionescumplimientorestaurantesdisposici\u00C3\u00B3nconsecuenciaelectr\u00C3\u00B3nicaaplicacionesdesconectadoinstalaci\u00C3\u00B3nrealizaci\u00C3\u00B3nutilizaci\u00C3\u00B3nenciclopediaenfermedadesinstrumentosexperienciasinstituci\u00C3\u00B3nparticularessubcategoria\u00D1\u0082\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D0\u00BA\u00D0\u00BE\u00D0\u00A0\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D0\u00B8\u00D0\u00B8\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D1\u008B\u00D0\u00B1\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D1\u0088\u00D0\u00B5\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D1\u0085\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D1\u0087\u00D0\u00B0\u00D0\u00B5\u00D1\u0081\u00D0\u00B5\u00D0\u00B9\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00B3\u00D0\u00B4\u00D0\u00B0\u00D0\u00A0\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D0\u00B8\u00D1\u008F\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D0\u00B5\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D0\u00B0\u00D0\u00B2\u00D0\u00BE\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0081\u00D0\u00B4\u00D0\u00B0\u00D0\u00BD\u00D0\u00BD\u00D1\u008B\u00D1\u0085\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00BD\u00D1\u008B\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00BD\u00D0\u00BE\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D1\u008B\u00D1\u0080\u00D1\u0083\u00D0\u00B1\u00D0\u00BB\u00D0\u00B5\u00D0\u00B9\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D1\u008B\u00D0\u00BD\u00D0\u00B8\u00D1\u0087\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B5\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00B5\u00D0\u00BD\u00D1\u0083\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D1\u0082\u00D0\u0
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private static class DataHolder {
|
||
|
|
private static final byte[] DATA;
|
||
|
|
|
||
|
|
static {
|
||
|
|
DATA = new byte[122784];
|
||
|
|
String[] chunks = {DataHolder0.getData(), DataHolder1.getData(), DataHolder2.getData()};
|
||
|
|
int sum = 0;
|
||
|
|
for (int i = 0; i < chunks.length; ++i) {
|
||
|
|
sum += chunks[i].length();
|
||
|
|
}
|
||
|
|
if (sum != DATA.length) {
|
||
|
|
throw new RuntimeException("Corrupted brotli dictionary");
|
||
|
|
}
|
||
|
|
sum = 0;
|
||
|
|
for (int i = 0; i < chunks.length; ++i) {
|
||
|
|
for (int j = 0; j < chunks[i].length(); ++j) {
|
||
|
|
DATA[sum++] = (byte) chunks[i].charAt(j);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
static byte[] getData() {
|
||
|
|
return DataHolder.DATA;
|
||
|
|
}
|
||
|
|
|
||
|
|
static final int[] OFFSETS_BY_LENGTH = {
|
||
|
|
0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864,
|
||
|
|
104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016
|
||
|
|
};
|
||
|
|
|
||
|
|
static final int[] SIZE_BITS_BY_LENGTH = {
|
||
|
|
0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5
|
||
|
|
};
|
||
|
|
|
||
|
|
static final int MIN_WORD_LENGTH = 4;
|
||
|
|
|
||
|
|
static final int MAX_WORD_LENGTH = 24;
|
||
|
|
|
||
|
|
static final int MAX_TRANSFORMED_WORD_LENGTH = 5 + MAX_WORD_LENGTH + 8;
|
||
|
|
}
|