Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
 package it.grabz.grabzit;
 

Author(s):
Skinners
class Response {
    @SuppressWarnings("unchecked")
    public <T> T Parse(URLConnection connectionClass<T> clazzthrows IOExceptionJAXBException {
        InputStream in = null;
        try {
            in = connection.getInputStream();
            JAXBContext context = JAXBContext.newInstance(clazz);
            Unmarshaller unmarshaller = context.createUnmarshaller();            
            return (T) unmarshaller.unmarshal(in);
        } finally {
            if (in != null) {
                in.close();
            }
        }
    }    
New to GrepCode? Check out our FAQ X