ã¾ããPattern#compileãã¦ãPatternãä½ãã
è¤æ°è¡ã«ããããªããã©ã°ãèããã
Patternãã§ãããMatcherãä½ãããã
ãã®ã¨ãå¿
è¦ãªã®ã¯CharSequenceã
ããã¯ãã¡ã¤ã«ã®å
容å
¨é¨ã渡ããããã
Javaãã¼ã使ããããªããªã
FileChannelããmapãã¦ãMappedByteBufferãä½ã£ã¦ãCharsetããCharsetDecoderä½ã£ã¦ãåç´ãªdecodeã§ã¯ãªããå¼æ°ã«CharBufferãããdecodeãå¼ã³ããã
åç´ãªdecodeã ã¨æããåç´ãªCharBufferãä½æããã¦ãã¾ãããã£ã¨ãã¼ãã«å±éãããã ãããããã¯åå¼ãã¦ãããããã
ãã®CharBufferã¯ãByteBuffer#allocateDirectããByteBufferã®asCharBuffer()ã«ã§ããªãã ããããCodeResultã®æ±ãæ¹ã¯ä»åº¦æ¸ããªããèãããææ¸ããã¨ãã¯ã©ããã£ã¦ããã ããããã
ç®è«è¦ã¨ãã¦ã¯ãã»ã¨ãã©å
¨é¨ãã¼ãå¤ã«ãªã£ã¦ããããã¨ãèãã¦ãããMappedByteBufferã¯ããã³ã¼ãå¾ã«ã¨ã£ã¨ã¨ããªããªã£ã¦ã»ãããGCèµ·ããªãã¨å³ããã ãããªã
allocateDirectãããµã¤ãºããã¾ãè¦ç©ãããªãããã³ã¼ããããaverageCharsPerByteãåããè¦ç©ããã®ã妥å½ãªãã ããã
MappedByteBufferã®limitã«ãå¹³åcharsãããã¦ãcharã®ãã¤ãæ°ã®2ããããã®ãï¼
ããã§ãã£ã¦ãã©ããã¡ã¢ãªç¢ºä¿ããããé©å½ãªã¨ããã§ç¹°ãä¸ãããã
æ¬å½ã«limitã§ããããããï¼
mapããã¨ãã«ãã£ãã«ã®sizeã渡ãã¤ããã§ããã®ãµã¤ãºã¨åãå¤ãlimitã«ããã¯ãã
ç¬éçã«ãã¼ãå¤ã«ããªãè² æ
ããããããã
JVMãªãã·ã§ã³ã§æ¡ããå¿
è¦ãã§ã¦ãããããããªãã
GCèµ·ããªãã¨ãããªãããä½åº¦ãåããã¨ããã¨Native OOMã³ã¼ã¹ã«ãªãå¯è½æ§ããããããããã«å¯¿å½ãçããããã¡ã«ãªãæ³å®ãªãã§ã使ãæ¹ã¨ãã¦ã¯ãã¾ãç´å¾ããããã®ã§ã¯ãªãã
ããã
ãå°ãããã¡ã¤ã«ãªãéãã¤ã¬ã¯ãã«ããã»ããå®å
¨ãããããªãããã³ãé£ããã
ãã¡ã¤ã«ã®ä¸èº«ãCharBufferã¨ãã¦æã¦ããã¨ã§ãæ£è¦è¡¨ç¾ã®å¹
ã¯åºããã
ç°¡åãªæ£è¦è¡¨ç¾ã§ãããªãã®ãªããreadLineãã¦æ£è¦è¡¨ç¾ããã°ã»ã¨ãã©ã®ãã¨ãã§ãããã ãã©ãè¤æ°è¡ããããããªãã¨ãCharBufferã使ããããªãã
è¤æ°ã®Patternãç¨æãã¦ãåãã«ä½æããMatcherã«å¯¾ãã¦ãusePatternå¼ã³åºãã§ããã¿ã¼ã³ã®åãæ¿ããã§ããã¨æãã
DOTALLãMULTILINEãã©ããªæãã«ä½¿ããã¯ããããããã ããã
ãã¨ã¯ãDOTALLãå¦å®å
èªã¿ãåæ¹åç
§/å¾æ¹åç
§ãæçä¸è´ããããã³ãã³ã使ãã°ãåºç¾é ä¸åãªãã°ã®è¤æ°è¡ã¢ãµã¼ã·ã§ã³ãã§ããããã«ãªãããããã¼ã®ããªã
åºç¾è¡ã®é åºã ãã§ãªãã1è¡å
ã®ãã¼ã¿ã®åºç¾é åºã¾ã§é ä¸åã ã£ãå ´åã«ãæ£è¦è¡¨ç¾ã§ãããããããããã ãããã©ãã°ã«ã¼ãããã¹ãããå ´åã®åç
§çªå·ã®è¦åãã¡ããã¨èª¬æãããã®ã§ããã£ãããã£ããæ¸ãã°ãªãã¨ããªãããã ã