Created
February 24, 2012 09:16
-
-
Save torao/1899691 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* RandomAccessFile をストリームとして扱いたい時はあるけど、こんな書き方でも環境互換性は | |
* 保証されるんだっけ? org.apache.hadoop.hdfs.server.common.Storage より | |
*/ | |
public void read(File from) throws IOException { | |
RandomAccessFile file = new RandomAccessFile(from, "rws"); | |
FileInputStream in = null; | |
try { | |
in = new FileInputStream(file.getFD()); | |
file.seek(0); | |
Properties props = new Properties(); | |
props.load(in); | |
getFields(props, this); | |
} finally { | |
if (in != null) { | |
in.close(); | |
} | |
file.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment