Changeset 343:7f06d669913d for kraken-linux-api/src/main/java/org/krakenapps/linux/api/EthernetInterface.java
- Timestamp:
- 09/18/11 13:55:15 (8 months ago)
- Branch:
- default
- Convert:
- svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2777
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kraken-linux-api/src/main/java/org/krakenapps/linux/api/EthernetInterface.java
r2 r343 1 package org.krakenapps.linux.api; 1 /* 2 * Copyright 2011 Future Systems 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */package org.krakenapps.linux.api; 2 16 3 17 import java.io.BufferedReader; … … 43 57 private List<AddressBinding> addressBindings; 44 58 45 public EthernetInterface(String device) throws FileNotFoundException {59 public EthernetInterface(String device) throws IOException { 46 60 BufferedReader br = null; 47 61 String line = null; … … 107 121 } 108 122 } 109 } catch (IOException e) {110 e.printStackTrace();111 123 } finally { 112 try {124 if (br != null) 113 125 br.close(); 114 } catch (IOException e) {115 e.printStackTrace();116 }117 126 } 118 127 … … 147 156 subAddr.description.add(line); 148 157 } 149 br.close(); 150 } catch (IOException e) { 151 e.printStackTrace(); 152 } 158 } finally { 159 if (br != null) 160 br.close(); 161 } 162 153 163 addressBindings.add(subAddr); 154 164 } 155 165 } 156 166 157 public static List<EthernetInterface> getEthernetInterfaces() {167 public static List<EthernetInterface> getEthernetInterfaces() throws IOException { 158 168 List<EthernetInterface> interfaces = new ArrayList<EthernetInterface>(); 159 169 String[] filenames = new File(cfgPath).list(new FilenameFilter() {
Note: See TracChangeset
for help on using the changeset viewer.
