static ZipOutputStream createZipOutputStream ( BufferedOutputStream outStream , Charset charset ) { if ( charset == null ) return new ZipOutputStream ( outStream ) ; try { Constructor < ZipOutputStream > constructor = ZipOutputStream . class . getConstructor ( new Class [ ] { OutputStream . class , Charset . class } ) ; return ( ZipOutputStream ) constructor . newInstance ( new Object [ ] { outStream , charset } ) ; } catch ( NoSuchMethodException e ) { throw new IllegalStateException ( MISSING_METHOD_PLEASE_UPGRADE , e ) ; } catch ( InstantiationException e ) { throw new IllegalStateException ( CONSTRUCTOR_MESSAGE_FOR_OUTPUT + e . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalStateException ( CONSTRUCTOR_MESSAGE_FOR_OUTPUT + e . getMessage ( ) , e ) ; } catch ( IllegalArgumentException e ) { throw new IllegalStateException ( CONSTRUCTOR_MESSAGE_FOR_OUTPUT + e . getMessage ( ) , e ) ; } catch ( InvocationTargetException e ) { throw new IllegalStateException ( CONSTRUCTOR_MESSAGE_FOR_OUTPUT + e . getMessage ( ) , e ) ; } }
Returns a ZipOutputStream opened with a given charset .