private EditableValueData createEditableCopy ( ValueData oldValue ) throws RepositoryException , IllegalStateException , IOException { if ( oldValue . isByteArray ( ) ) { // bytes, make a copy of real data byte [ ] oldBytes = oldValue . getAsByteArray ( ) ; byte [ ] newBytes = new byte [ oldBytes . length ] ; System . arraycopy ( oldBytes , 0 , newBytes , 0 , newBytes . length ) ; try { return new EditableValueData ( newBytes , oldValue . getOrderNumber ( ) ) ; } catch ( IOException e ) { throw new RepositoryException ( e ) ; } } else { // edited BLOB file, make a copy try { return new EditableValueData ( oldValue . getAsStream ( ) , oldValue . getOrderNumber ( ) , spoolConfig ) ; } catch ( FileNotFoundException e ) { throw new RepositoryException ( "Create editable copy error. " + e , e ) ; } catch ( IOException e ) { throw new RepositoryException ( "Create editable copy error. " + e , e ) ; } } }
Create editable ValueData copy .