Questo è l'algoritmo

codice:
try {
			     
			 CmsFile Destination=cmsObj.readFile(destinazione);
			 ArrayList<byte[]> AllFile= new ArrayList<byte[]>();
			 AllFile.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>".getBytes("UTF-8"));
			 AllFile.add("\n<ROOT>".getBytes("UTF-8"));
			 for (CmsResource file : lista) {
			
				CmsFile file1=cmsObj.readFile(file); 
				String sitePath= cmsObj.getSitePath(file );	
				String xml = new String(file1.getContents());
				// nuovo codice 
				int m_input = 2048;
				int len;
				InputStream resourceInputStream =new ByteArrayInputStream(file1.getContents());
				Reader reader = new InputStreamReader(resourceInputStream);
				char[] buffer = new char[m_input];
				
                //InputStream istream = new BufferedInputStream(resourceInputStream);

				//byte[] buffer = new byte[m_input];
				 while (true) {
	                    try {
	                        len = reader.read(buffer);
	                        if (len == -1) {
	                            break;
	                        }
	                        byte[] buffer1 = new byte[len];
	                        for(int i=0;i<len;i++){
	                        	if(buffer[i]=='”' || buffer[i]=='“'  ){
	                        		buffer1[i]=(byte)'”';
	                        	}
	                        	buffer1[i]=(byte)buffer[i];
	                        }
	                        
	                        
	                        
	                        AllFile.add(buffer1);
	                    } catch (IOException e) {
	                        len = -1;
	                        break;
	                    }
	                }
				
				// fine
Che devo impostare? Sto ad impazzire...