package com.tutego.insel.solutions.util;
import java.util.*;
import java.net.*;

public class BinProperty extends Properties
{
  public void putBin( String s, byte[] b )
  {
    setProperty( s, URLEncoder.encode(new String(b)) );
  }

  public byte[] getBin( String key )
  {
	String val = "";
	  
	try {
	   val = getProperty( URLDecoder.decode(key) );
    } catch ( Exception e ) { }
	  
    return val.getBytes();
  }

  public static void main( String args[] )
  {
    BinProperty bin = new BinProperty();

	// rein
	  
	byte bs[] = "%d#ä?=)/".getBytes();
	  
    bin.putBin( "Eins", bs );

	// raus
	
	bs = bin.getBin("Eins");
	
    System.out.println( bin.getProperty("Eins") );

	System.out.println( bs );
  }
}

