| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

Java ContentDisposition からファイル名を抜き出す

提供: MyMemoWiki
ナビゲーションに移動 検索に移動

Java ContentDisposition からファイル名を抜き出す

Java |

  1. Pattern ptn = Pattern.compile(".*filename\\s*=\\s*[\"]{0,1}([^\"]+)[\"]{0,1}.*")
  2. Matcher matcher = ptn.matcher(contentDisposition);
  3. if (matcher.matches()) {
  4. filename = matcher.group(1);
  5. }