Index: ArchiveStreamFactory.java
===================================================================
--- ArchiveStreamFactory.java	(revision 699711)
+++ ArchiveStreamFactory.java	(working copy)
@@ -75,30 +75,30 @@
         }
 	}
 	
-    public ArchiveInputStream createArchiveInputStream( final String archiverName, final InputStream out ) throws ArchiveException {
+    public ArchiveInputStream createArchiveInputStream( final String archiverName, final InputStream input ) throws ArchiveException {
         try {
             final Class clazz = (Class) inputStreamClasses.get(archiverName);
 
             if (clazz == null) {
-            	throw new ArchiveException("ArchiverFactory could not create instance");
+            	throw new ArchiveException("ArchiveStreamFactory could not create instance");
             }
 
             final Class[] params = { InputStream.class };
             final Constructor constructor = clazz.getConstructor(params);
-            final Object[] initargs = { out };
+            final Object[] initargs = { input };
             return (ArchiveInputStream) constructor.newInstance(initargs);
         } catch (InstantiationException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (IllegalAccessException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (SecurityException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (NoSuchMethodException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (IllegalArgumentException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (InvocationTargetException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         }
     }
 
@@ -115,33 +115,34 @@
             final Object[] initargs = { out };
             return (ArchiveOutputStream) constructor.newInstance(initargs);
         } catch (InstantiationException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (IllegalAccessException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (SecurityException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (NoSuchMethodException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (IllegalArgumentException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         } catch (InvocationTargetException e) {
-            throw new ArchiveException("ArchiverFactory could not create instance", e);
+            throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
         }
     }
 
-    public ArchiveInputStream createArchiveInputStream( final InputStream input ) throws IOException {
+    public ArchiveInputStream createArchiveInputStream( final InputStream input ) throws ArchiveException {
 
 		final byte[] signature = new byte[12];
 		input.mark(signature.length);
-		input.read(signature);
-		// reset not supported exception?
-		input.reset();
-
-//		for (int i = 0; i < signature.length; i++) {
-//			System.out.print(Integer.toHexString(signature[i]));
-//			System.out.print(",");
-//		}
-//		System.out.println("");
+		try {
+			input.read(signature);
+		} catch (IOException e) {
+			throw new ArchiveException("Could not read archive inputstream's signature", e);
+		}
+		try {
+			input.reset();
+		} catch (IOException e) {
+			throw new ArchiveException("Could not reset stream", e);
+		}
 		
 		for (Iterator it = inputStreamClasses.values().iterator(); it.hasNext();) {
 			final Class clazz = (Class) it.next();
@@ -157,11 +158,17 @@
 		            return (ArchiveInputStream) constructor.newInstance(initargs);					
 				}
 			} catch (SecurityException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			} catch (NoSuchMethodException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			} catch (IllegalArgumentException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			} catch (IllegalAccessException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			} catch (InvocationTargetException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			} catch (InstantiationException e) {
+				throw new ArchiveException("ArchiveStreamFactory could not create instance", e);
 			}
 		}
 		return null;
