-/*\r
- * unexpected file format founded exception\r
- *\r
- * License : The MIT License\r
- * Copyright(c) 2010 MikuToga Partners\r
- */\r
-\r
-package jp.sourceforge.mikutoga.parser;\r
-\r
-/**\r
- * MMD関連ファイルのパース異常系。\r
- * 必要に応じて、パースに失敗した位置を保持する。\r
- */\r
-@SuppressWarnings("serial")\r
-public class MmdFormatException extends Exception {\r
-\r
- private final long position;\r
-\r
- /**\r
- * コンストラクタ。\r
- */\r
- public MmdFormatException(){\r
- this(null);\r
- return;\r
- }\r
-\r
- /**\r
- * コンストラクタ。\r
- * @param message エラーメッセージ\r
- */\r
- public MmdFormatException(String message){\r
- this(message, -1L);\r
- return;\r
- }\r
-\r
- /**\r
- * コンストラクタ。\r
- * @param position 入力ソース先頭から数えたエラー位置。(バイト単位)\r
- * 負の値を与えると、エラー位置は無効と解釈される。\r
- */\r
- public MmdFormatException(long position){\r
- this(null, position);\r
- return;\r
- }\r
-\r
- /**\r
- * コンストラクタ。\r
- * @param message エラーメッセージ\r
- * @param position 入力ソース先頭から数えたエラー位置。(バイト単位)\r
- * 負の値を与えると、エラー位置は無効と解釈される。\r
- */\r
- public MmdFormatException(String message, long position){\r
- super(message);\r
- this.position = position;\r
- return;\r
- }\r
-\r
- /**\r
- * {@inheritDoc}\r
- * 有効なエラー発生位置を保持している場合、追加出力される。\r
- * @return {@inheritDoc}\r
- */\r
- @Override\r
- public String getMessage(){\r
- StringBuilder result = new StringBuilder();\r
-\r
- String msg = super.getMessage();\r
- if(msg != null) result.append(msg);\r
-\r
- if(hasPosition()){\r
- result.append('(')\r
- .append("position:")\r
- .append(this.position)\r
- .append(')');\r
- }\r
-\r
- if(result.length() <= 0) return null;\r
-\r
- return result.toString();\r
- }\r
-\r
- /**\r
- * エラー位置を取得する。\r
- * @return 入力ソース先頭からのバイト数で表されるエラー位置。\r
- * 負なら無効なエラー位置。\r
- */\r
- public long getPosition(){\r
- return this.position;\r
- }\r
-\r
- /**\r
- * 有効なエラー位置が設定されているか判定する。\r
- * @return エラー位置が有効(非負)ならtrue\r
- */\r
- public boolean hasPosition(){\r
- if(this.position < 0L) return false;\r
- return true;\r
- }\r
-\r
-}\r
+/*
+ * unexpected file format founded exception
+ *
+ * License : The MIT License
+ * Copyright(c) 2010 MikuToga Partners
+ */
+
+package jp.sourceforge.mikutoga.parser;
+
+/**
+ * MMD関連ファイルのパース異常系。
+ * 必要に応じて、パースに失敗した位置を保持する。
+ */
+@SuppressWarnings("serial")
+public class MmdFormatException extends Exception {
+
+ private final long position;
+
+ /**
+ * コンストラクタ。
+ */
+ public MmdFormatException(){
+ this(null);
+ return;
+ }
+
+ /**
+ * コンストラクタ。
+ * @param message エラーメッセージ
+ */
+ public MmdFormatException(String message){
+ this(message, -1L);
+ return;
+ }
+
+ /**
+ * コンストラクタ。
+ * @param position 入力ソース先頭から数えたエラー位置。(バイト単位)
+ * 負の値を与えると、エラー位置は無効と解釈される。
+ */
+ public MmdFormatException(long position){
+ this(null, position);
+ return;
+ }
+
+ /**
+ * コンストラクタ。
+ * @param message エラーメッセージ
+ * @param position 入力ソース先頭から数えたエラー位置。(バイト単位)
+ * 負の値を与えると、エラー位置は無効と解釈される。
+ */
+ public MmdFormatException(String message, long position){
+ super(message);
+ this.position = position;
+ return;
+ }
+
+ /**
+ * {@inheritDoc}
+ * 有効なエラー発生位置を保持している場合、追加出力される。
+ * @return {@inheritDoc}
+ */
+ @Override
+ public String getMessage(){
+ StringBuilder result = new StringBuilder();
+
+ String msg = super.getMessage();
+ if(msg != null) result.append(msg);
+
+ if(hasPosition()){
+ result.append('(')
+ .append("position:")
+ .append(this.position)
+ .append(')');
+ }
+
+ if(result.length() <= 0) return null;
+
+ return result.toString();
+ }
+
+ /**
+ * エラー位置を取得する。
+ * @return 入力ソース先頭からのバイト数で表されるエラー位置。
+ * 負なら無効なエラー位置。
+ */
+ public long getPosition(){
+ return this.position;
+ }
+
+ /**
+ * 有効なエラー位置が設定されているか判定する。
+ * @return エラー位置が有効(非負)ならtrue
+ */
+ public boolean hasPosition(){
+ if(this.position < 0L) return false;
+ return true;
+ }
+
+}