// Path: src/main/java/org/rhq/simone/util/IOUtil.java
// public static void closeQuietly(Closeable closeable) {
//   if (closeable != null) {
//     try {
//       closeable.close();
//     } catch (IOException ignore) {
//     }
//   }
// }
// 
// Path: src/main/java/org/rhq/simone/cpu/CpuDetails.java
// public class CpuDetails {
// 
//   private final String vendorId;
//   private final String modelName;
//   private final int cpuFrequency;
//   private final int cacheSize;
// 
//   public CpuDetails(String vendorId, String modelName, int cpuFrequency, int cacheSize) {
//     this.vendorId = vendorId;
//     this.modelName = modelName;
//     this.cpuFrequency = cpuFrequency;
//     this.cacheSize = cacheSize;
//   }
// 
//   public String getVendorId() {
//     return vendorId;
//   }
// 
//   public String getModelName() {
//     return modelName;
//   }
// 
//   /**
//    * @return frequency in MHz
//    */
//   public int getCpuFrequency() {
//     return cpuFrequency;
//   }
// 
//   /**
//    * @return cache size in kilobytes
//    */
//   public int getCacheSize() {
//     return cacheSize;
//   }
// 
//   @Override
//   public String toString() {
//     return "CpuDetails[" +
//            "vendorId='" + vendorId + '\'' +
//            ", modelName='" + modelName + '\'' +
//            ", cpuFrequency(MHz)=" + cpuFrequency +
//            ", cacheSize(KB)=" + cacheSize +
//            ']';
//   }
// }


import static org.rhq.simone.util.IOUtil.closeQuietly;
import org.rhq.simone.cpu.CpuDetails;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
/*
 * Copyright 2014 Red Hat, Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.rhq.simone.cpu.linux;




/**
 * @author Thomas Segismont
 */
class CpuDetailsParser implements Iterable<CpuDetails>, Closeable {

  private final BufferedReader bufferedReader;

  CpuDetailsParser(BufferedReader bufferedReader) {
    this.bufferedReader = bufferedReader;
  }

  @Override
  public Iterator<CpuDetails> iterator() {
    return new CpuDetailsIterator(bufferedReader);
  }

  @Override
  public void close() throws IOException {
// Path: src/main/java/org/rhq/simone/util/IOUtil.java
// public static void closeQuietly(Closeable closeable) {
//   if (closeable != null) {
//     try {
//       closeable.close();
//     } catch (IOException ignore) {
//     }
//   }
// }
// 
// Path: src/main/java/org/rhq/simone/cpu/CpuDetails.java
// public class CpuDetails {
// 
//   private final String vendorId;
//   private final String modelName;
//   private final int cpuFrequency;
//   private final int cacheSize;
// 
//   public CpuDetails(String vendorId, String modelName, int cpuFrequency, int cacheSize) {
//     this.vendorId = vendorId;
//     this.modelName = modelName;
//     this.cpuFrequency = cpuFrequency;
//     this.cacheSize = cacheSize;
//   }
// 
//   public String getVendorId() {
//     return vendorId;
//   }
// 
//   public String getModelName() {
//     return modelName;
//   }
// 
//   /**
//    * @return frequency in MHz
//    */
//   public int getCpuFrequency() {
//     return cpuFrequency;
//   }
// 
//   /**
//    * @return cache size in kilobytes
//    */
//   public int getCacheSize() {
//     return cacheSize;
//   }
// 
//   @Override
//   public String toString() {
//     return "CpuDetails[" +
//            "vendorId='" + vendorId + '\'' +
//            ", modelName='" + modelName + '\'' +
//            ", cpuFrequency(MHz)=" + cpuFrequency +
//            ", cacheSize(KB)=" + cacheSize +
//            ']';
//   }
// }


// Path: src/main/java/org/rhq/simone/cpu/linux/CpuDetailsParser.java
import static org.rhq.simone.util.IOUtil.closeQuietly;
import org.rhq.simone.cpu.CpuDetails;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;

/*
 * Copyright 2014 Red Hat, Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.rhq.simone.cpu.linux;




/**
 * @author Thomas Segismont
 */
class CpuDetailsParser implements Iterable<CpuDetails>, Closeable {

  private final BufferedReader bufferedReader;

  CpuDetailsParser(BufferedReader bufferedReader) {
    this.bufferedReader = bufferedReader;
  }

  @Override
  public Iterator<CpuDetails> iterator() {
    return new CpuDetailsIterator(bufferedReader);
  }

  @Override
  public void close() throws IOException {
    closeQuietly(bufferedReader);