を含む文字列から書き込まれたテキスト ファイルからデータを読み取ろうとしています\n
。その結果、これらの文字は改行として書き込まれています。読み返してみると、
FileInputStream
、InputStreamReader
およびを使用していBufferedReader
ます。しかし、一行一行読み込んでいくと、読み手は改行に気付き、それを行末と数えてしまいます。私が本当に欲しいのは、改行を維持しながら行末まで読むことです。実際に文字が書けるか、ファイル作成時に試して\
みn
たのですが、どうやっても普通の改行にならずに書けません。
改行を維持しながらこのファイルを読み込むにはどうすればよいですか?
編集:明確にするために、ここに私が読んでいるデータのサンプルがあります。ご覧のとおり、各行はそれぞれの行にありArgs
ます。これは無視したい改行です。各コマンド (dt、e、b、c、o など) に独自の行が必要です。理想的には次のようになります。
o Desc: Opens a file or folder#Args: [<handle or path>] -- the path of the file or folder#(<file name>) -- the name of the file to open. Omit if you are opening a folder.
無視したい改行文字を#
記号に置き換えました。ただし、ファイルをプログラムに読み戻すときにSystem.out.println();
、行が置き換えられた改行が#
正しく表示されるようにしたいのです。
dt Desc: Toggles the state of debug mode.
e Desc: Exits QuiConsole
b Desc: Goes to the specified webpages.
Args: [<URLs>] -- the URLs of the webpages to visit, separated by spaces
c Desc: Clears the console window.
o Desc: Opens a file or folder
Args: [<handle or path>] -- the path of the file or folder
(<file name>) -- the name of the file to open. Omit if you are opening a folder
l Desc: Searches the web
Args: [<query>] -- the query to search for
h Desc: Displays a list of all the current handles.
Args: (<handle names>) -- displays information for only the specified handles.
info Desc: Displays information about QuiConsole
help Desc: Displays a list of all commands, their descriptions and their arguments, if any exist.
Args: (<command names>) -- Displays information for the specified command only. Ignores any invalid command names.
s Desc: Shuts down, restarts, hibernates or logs off the computer.
Args: [s,r,h,l] -- shuts down, restarts, hibernates or logs off the computer respectively.
(<integer value>) -- the number of seconds to delay the action.
dh Desc: Deletes all handles
Args: (<handle names>) -- deletes only the specified handles
r Desc: Runs the specified program
Args: [<names>] -- the names of the programs to run. Separate programs by a space.
wa Desc: Displays the answer from Wolfram|Alpha
Args: [<query>] -- the query to send to Wolfram|Alpha
ch Desc: Modifies a handle
Args: [<handle names>] -- the handle to change
[<new value>] -- the new value to assign to the handle
ah Desc: Adds the specified handles.
Args: [handle] -- name of the handle.
[value] -- value for the handle
ds Desc: Displays the state of debug mode.
dhist Desc: Deletes command history