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):
GrabzIt
class Response {
    @SuppressWarnings("unchecked")
    public <T> T Parse(URLConnection connectionClass<T> clazzthrows IOExceptionJAXBExceptionException {
        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();
            }
            HttpUtility.CheckResponse(connection);
        }
    }    
New to GrepCode? Check out our FAQ X