Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2013 Alibaba.com All right reserved. This software is the
  * confidential and proprietary information of Alibaba.com ("Confidential
  * Information"). You shall not disclose such Confidential Information and shall
  * use it only in accordance with the terms of the license agreement you entered
  * into with Alibaba.com.
  */
 package com.alibaba.simpleimage.analyze.sift.io;
 

Author(s):
axman 2013-5-15 11:04:59
public class KDFeaturePointInfoReader {
    private final static Logger logger = Logger.getLogger(KDFeaturePointInfoReader.class);
    public static KDFeaturePointListInfo readComplete(String filePath) {
        ObjectInputStream fis = null;
        try {
            File f = new File(filePath);
            fis = new ObjectInputStream(new FileInputStream(f));
            int count = fis.readInt();
            if (count == 0) return null;
            List<KDFeaturePointal = new ArrayList<KDFeaturePoint>();
            for (int i = 0; i < counti++) {
                KDFeaturePoint kp = (KDFeaturePointfis.readObject();
                al.add(kp);
            }
            int w = fis.readInt();
            int h = fis.readInt();
            KDFeaturePointListInfo kfl = new KDFeaturePointListInfo();
            kfl.setImageFile(f.getName());
            kfl.setList(al);
            kfl.setWidth(w);
            kfl.setHeight(h);
            return kfl;
        } catch (Exception e) {
            e.printStackTrace();
            .equals(e.getMessage());
            return null;
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    .equals(e.getMessage());
                }
            }
        }
    }
    public static KDFeaturePointListInfo readComplete(ObjectInputStream fisString name) {
        try {
            int count = fis.readInt();
            if (count == 0) return null;
            List<KDFeaturePointal = new ArrayList<KDFeaturePoint>();
            for (int i = 0; i < counti++) {
                KDFeaturePoint kp = (KDFeaturePointfis.readObject();
                al.add(kp);
            }
            int w = fis.readInt();
            int h = fis.readInt();
            KDFeaturePointListInfo kfl = new KDFeaturePointListInfo();
            kfl.setImageFile(name);
            kfl.setList(al);
            kfl.setWidth(w);
            kfl.setHeight(h);
            return kfl;
        } catch (Exception e) {
            .equals(e.getMessage());
            return null;
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    .equals(e.getMessage());
                }
            }
        }
    }
New to GrepCode? Check out our FAQ X