1 15 package org.apache.tapestry.util.io; 16 17 import java.io.IOException ; 18 19 import org.apache.tapestry.services.DataSqueezer; 20 21 28 29 public class CharacterAdaptor implements ISqueezeAdaptor 30 { 31 private static final String PREFIX = "c"; 32 private static final char PREFIX_CH = 'c'; 33 34 public String squeeze(DataSqueezer squeezer, Object data) throws IOException 35 { 36 Character charData = (Character )data; 37 char value = charData.charValue(); 38 39 char[] buffer = new char[] 40 { 41 PREFIX_CH, value 42 }; 43 44 return new String (buffer); 45 } 46 47 public Object unsqueeze(DataSqueezer squeezer, String string) throws IOException 48 { 49 return new Character (string.charAt(1)); 50 } 51 52 public void register(DataSqueezer squeezer) 53 { 54 squeezer.register(PREFIX, Character .class, this); 55 } 56 57 } 58 | Popular Tags |