字符串解压

	/** 
	 * 将压缩后的 Object 数据解压缩 
	 * 
	 * @param compressed 压缩后的 Object 数据 
	 * @return 解压后的字符串 Object
	 * @throws Exception 	
	 */ 
	public static final Object decompress(Object compressed)     { 
		if(compressed == null) 
			return null; 


		InputStream in = null;
		ZipInputStream zin = null;

		ObjectInputStream oin = null;

		try { 

			byte[] by= new BASE64Decoder().decodeBuffer(compressed.toString());
			in =new ByteArrayInputStream(by);
			zin = new ZipInputStream(in);
			zin.getNextEntry();
			oin = new ObjectInputStream(zin);

			return oin.readObject();

		} catch (Exception e) { 
			e.printStackTrace();
			return null;
		} finally { 
			if(oin != null) { 
				try {oin.close();} catch(IOException e) {} 
			} 
			if(zin != null) { 
				try {zin.close();} catch(IOException e) {} 
			} 
			if(in != null) { 
				try {in.close();} catch(IOException e) {} 
			} 
		} 


	} 

你可能感兴趣的:(字符串)