Index: pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
===================================================================
--- pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java	(revision 938120)
+++ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java	(working copy)
@@ -812,65 +812,70 @@
      */
     private COSName getEncodingFromFont() throws IOException
     {
-        //This whole section of code needs to be replaced with an actual
-        //type1 font parser!!
+    	//This whole section of code needs to be replaced with an actual
+    	//type1 font parser!!
 
 
-        COSName retvalue = null;
-        //recuperer le programme de fonte dans son stream qui doit se trouver
-        //dans le flux r�f�renc� par � la cl� FileFont lui m�me situ� dans
-        //le dictionnaire associ� � /FontDescriptor du dictionnaire de type /Font courrant
-        //get the font program in the stream which should be located in
-         //the /FileFont Stream object himself in the /FontDescriptior of the current
-        //font dictionary
-        COSDictionary fontDescriptor = (COSDictionary) font.getDictionaryObject(
-            COSName.FONT_DESC);
-        if( fontDescriptor != null )
-        {
-            COSStream fontFile = (COSStream) fontDescriptor.getDictionaryObject(
-                COSName.FONT_FILE);
-            if( fontFile != null )
-            {
-                BufferedReader in =
-                        new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
-                /**
-                 * this section parse the FileProgram stream searching for a /Encoding entry
-                 * the research stop if the entry "currentdict end" is reach or after 100 lignes
-                 */
-                StringTokenizer st = null;
-                boolean found = false;
-                String line = "";
-                String key = null;
-                for( int i = 0; null!=( line = in.readLine() ) &&
-                                i < 40  &&
-                                !line.equals("currentdict end")
-                                && !found; i++)
-                {
-                    st = new StringTokenizer(line);
-                    if( st.hasMoreTokens() )
-                    {
-                        key = st.nextToken();
-                        if(key.equals("/Encoding") && st.hasMoreTokens() )
-                        {
-                            COSName value = COSName.getPDFName( st.nextToken() );
-                            found = true;
-                            if( value.equals( COSName.MAC_ROMAN_ENCODING ) ||
-                                value.equals( COSName.PDF_DOC_ENCODING ) ||
-                                value.equals( COSName.STANDARD_ENCODING ) ||
-                                value.equals( COSName.WIN_ANSI_ENCODING ) )
-                            {
-                                //value is expected to be one of the encodings
-                                //ie. StandardEncoding,WinAnsiEncoding,MacRomanEncoding,PDFDocEncoding
-                                retvalue = value;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return retvalue;
+    	COSName retvalue = null;
+    	//recuperer le programme de fonte dans son stream qui doit se trouver
+    	//dans le flux r�f�renc� par � la cl� FileFont lui m�me situ� dans
+    	//le dictionnaire associ� � /FontDescriptor du dictionnaire de type /Font courrant
+    	//get the font program in the stream which should be located in
+    	//the /FileFont Stream object himself in the /FontDescriptior of the current
+    	//font dictionary
+    	COSDictionary fontDescriptor = (COSDictionary) font.getDictionaryObject(
+    			COSName.FONT_DESC);
+    	if( fontDescriptor != null )
+    	{
+    		COSStream fontFile = (COSStream) fontDescriptor.getDictionaryObject(
+    				COSName.FONT_FILE);
+    		if( fontFile != null )
+    		{
+    			BufferedReader in=null;
+    			try {
+    				in = new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
+    				/**
+    				 * this section parse the FileProgram stream searching for a /Encoding entry
+    				 * the research stop if the entry "currentdict end" is reach or after 100 lignes
+    				 */
+    				StringTokenizer st = null;
+    				boolean found = false;
+    				String line = "";
+    				String key = null;
+    				for( int i = 0; null!=( line = in.readLine() ) &&
+    				i < 40  &&
+    				!line.equals("currentdict end")
+    				&& !found; i++)
+    				{
+    					st = new StringTokenizer(line);
+    					if( st.hasMoreTokens() )
+    					{
+    						key = st.nextToken();
+    						if(key.equals("/Encoding") && st.hasMoreTokens() )
+    						{
+    							COSName value = COSName.getPDFName( st.nextToken() );
+    							found = true;
+    							if( value.equals( COSName.MAC_ROMAN_ENCODING ) ||
+    									value.equals( COSName.PDF_DOC_ENCODING ) ||
+    									value.equals( COSName.STANDARD_ENCODING ) ||
+    									value.equals( COSName.WIN_ANSI_ENCODING ) )
+    							{
+    								//value is expected to be one of the encodings
+    								//ie. StandardEncoding,WinAnsiEncoding,MacRomanEncoding,PDFDocEncoding
+    								retvalue = value;
+    							}
+    						}
+    					}
+    				}
+    			}
+    			finally {
+    				if (in != null)
+    					in.close();
+    			}
+    		}
+    	}
+    	return retvalue;
     }
-
     /**
      * This will get the fonts bouding box.
      *
