src/core/net/sf/basedb/util/encode/EncoderDecoder.java

Code
Comments
Other
Rev Date Author Line
5188 09 Nov 09 nicklas 1 /**
5188 09 Nov 09 nicklas 2   $Id $
5188 09 Nov 09 nicklas 3
5188 09 Nov 09 nicklas 4   Copyright (C) 2009 Nicklas Nordborg
5188 09 Nov 09 nicklas 5
5188 09 Nov 09 nicklas 6   This file is part of BASE - BioArray Software Environment.
5188 09 Nov 09 nicklas 7   Available at http://base.thep.lu.se/
5188 09 Nov 09 nicklas 8
5188 09 Nov 09 nicklas 9   BASE is free software; you can redistribute it and/or
5188 09 Nov 09 nicklas 10   modify it under the terms of the GNU General Public License
5188 09 Nov 09 nicklas 11   as published by the Free Software Foundation; either version 3
5188 09 Nov 09 nicklas 12   of the License, or (at your option) any later version.
5188 09 Nov 09 nicklas 13
5188 09 Nov 09 nicklas 14   BASE is distributed in the hope that it will be useful,
5188 09 Nov 09 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
5188 09 Nov 09 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5188 09 Nov 09 nicklas 17   GNU General Public License for more details.
5188 09 Nov 09 nicklas 18
5188 09 Nov 09 nicklas 19   You should have received a copy of the GNU General Public License
5188 09 Nov 09 nicklas 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
5188 09 Nov 09 nicklas 21 */
5188 09 Nov 09 nicklas 22 package net.sf.basedb.util.encode;
5188 09 Nov 09 nicklas 23
5188 09 Nov 09 nicklas 24 /**
5188 09 Nov 09 nicklas 25   Interface for encoding and decoding strings to make them work in a certain
5188 09 Nov 09 nicklas 26   context. For example, in tab-separated text files tabs, newlines, etc. need
5188 09 Nov 09 nicklas 27   to be encoded or the number of columns or lines will be incorrect.
5188 09 Nov 09 nicklas 28   <p>
5188 09 Nov 09 nicklas 29   An encoder is usually paired with a decoder. It is not a requirement that the
5188 09 Nov 09 nicklas 30   encoding is symmetrical. If the encoding is symmetrical the result of encoding
5188 09 Nov 09 nicklas 31   and then decoding must be equal the original string and so must the result of 
5188 09 Nov 09 nicklas 32   decoding and then encoding.
5188 09 Nov 09 nicklas 33   <p>
5188 09 Nov 09 nicklas 34   It is up to the implementation how null values are handled. Some implementations
5188 09 Nov 09 nicklas 35   may not support null and may throw an exception. Note that null value handling must
5188 09 Nov 09 nicklas 36   also be symmetrical if {@link #isSymmetrical()} returns true.
5188 09 Nov 09 nicklas 37   
5188 09 Nov 09 nicklas 38   @since 2.15
5188 09 Nov 09 nicklas 39   @author Nicklas
5188 09 Nov 09 nicklas 40 */
5188 09 Nov 09 nicklas 41 public interface EncoderDecoder 
5188 09 Nov 09 nicklas 42 {
5188 09 Nov 09 nicklas 43   /**
5188 09 Nov 09 nicklas 44     @return TRUE if the encoder is symmetrical, FALSE if not
5188 09 Nov 09 nicklas 45   */
5188 09 Nov 09 nicklas 46   public boolean isSymmetrical();
5188 09 Nov 09 nicklas 47   
5188 09 Nov 09 nicklas 48   /**
5188 09 Nov 09 nicklas 49     @param s The string to encode
5188 09 Nov 09 nicklas 50     @return The encoded string
5188 09 Nov 09 nicklas 51   */
5188 09 Nov 09 nicklas 52   public String encode(String s);
5188 09 Nov 09 nicklas 53   
5188 09 Nov 09 nicklas 54   /**
5188 09 Nov 09 nicklas 55     @param s The string to decode
5188 09 Nov 09 nicklas 56     @return The decoded string
5188 09 Nov 09 nicklas 57   */
5188 09 Nov 09 nicklas 58   public String decode(String s);
5188 09 Nov 09 nicklas 59   
5188 09 Nov 09 nicklas 60 }