4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
7 * Wooyoung Cho <wooyoung1.cho@samsung.com>
8 * Shihyun Kim <shihyun.kim@samsung.com>
9 * Taeyoung Son <taeyoung2.son@samsung.com>
10 * Yongsung kim <yongsung1.kim@samsung.com>
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
29 package org.tizen.installmanager.lib.linux;
31 import java.io.BufferedReader;
33 import java.io.IOException;
34 import java.io.InputStreamReader;
35 import java.util.ArrayList;
36 import java.util.List;
37 import java.util.StringTokenizer;
39 import org.tizen.installmanager.lib.IFileSystemInformation;
40 import org.tizen.installmanager.lib.Log;
44 * Provide information of linux file system.
46 * @author Taeyoung Son <taeyoung2.son@samsung.com>
49 public class LinuxFileSystemInfo implements IFileSystemInformation {
52 public List<File> getListMounts() {
53 List<File> mountList = new ArrayList<File>();
54 BufferedReader reader = null;
55 InputStreamReader ipStream = null;
59 Process p=Runtime.getRuntime().exec("df -k");
61 ipStream = new InputStreamReader(p.getInputStream());
62 reader = new BufferedReader(ipStream);
64 String line = reader.readLine();
65 String partition = "";
66 List<String> deviceInfo= new ArrayList<String>();
70 StringTokenizer tokens = new StringTokenizer(line, " ");
71 int deviceNameColumn = tokens.countTokens();
72 while(tokens.hasMoreTokens()){
73 deviceInfo.add(tokens.nextToken());
75 for (int i=5; i < deviceNameColumn;i++) {
76 partition += deviceInfo.get(i);
77 if(i!=(deviceNameColumn-1))
80 mountList.add(new File(partition));
82 line=reader.readLine();
86 } catch(IOException e1) {
88 } catch(InterruptedException e2) {
91 if (ipStream != null) {
94 } catch (IOException e) {
102 } catch (IOException e) {
112 public File[] getListDevices() {
113 // TODO Auto-generated method stub
118 public FileSystemType getFileSystemType(File disk) {
119 // TODO Auto-generated method stub
120 return FileSystemType.UNKNOWN;