我想编写一个Java程序,它获取关系规范文件名称的输入(在命令行中),并以适当的格式将关系数据插入Redis
文件(txt)内容:
public static void main(String[] args) {
//Connecting to Redis server on localhost
Jedis jedis = new Jedis("localhost", 6379);
System.out.println("Connection to server sucessfully");
//check whether server is running or not
System.out.println("Server is running: "+jedis.ping());
try (BufferedReader br = new BufferedReader(new FileReader(".../testing")))
{
String sCurrentLine; List<String> list = new ArrayList<String>();
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
//list.add(sCurrentLine);
/*for( String MyFile: sCurrentLine.split(";")){ System.out.println(MyFile); jedis.hmset(MyFile); } */
System.out.println(sCurrentLine);
jedis.set(sCurrentLine, " ");
}
//String[] stringArr = list.toArray(new String[0]);
//System.out.println(list);
} catch (IOException e)
{ e.printStackTrace(); }
}
第一行(工作人员)仅包含表格名称
{{1}}
我试过的所有这些,抱歉不好的演示....你知道如何以正确格式插入这种文本文件吗?
有没有人有任何想法?