Back to project page FlashTransmitter.
The source code is released under:
GNU General Public License
If you think the Android project FlashTransmitter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.catinthedark.flash_transmitter.lib.algorithm; /* ww w.ja v a 2 s .c om*/ /** * Created by Ilya on 15.04.2014. */ /** * Convert text into array of transmitting-bits. * Convert received-bits into text. */ public class Converter { private EncodingScheme encodingScheme; private ErrorCorrectionLayer errorCorrectionLayer; private LogicalCodeLayer logicalCodeLayer; private LineCoder lineCoder; public Converter(EncodingScheme scheme, LineCoder coder, ErrorCorrectionLayer correction, LogicalCodeLayer logical) { this.encodingScheme = scheme; this.lineCoder = coder; this.errorCorrectionLayer = correction; this.logicalCodeLayer = logical; } public Byte[] makeBits(String text){ return lineCoder.pack( logicalCodeLayer.pack( errorCorrectionLayer.addRedundancy( encodingScheme.getBitCodes(text)))); } public String makeString(Byte[] bits) { return encodingScheme.getSymbolsByBits( errorCorrectionLayer.recoverData( logicalCodeLayer.unpack( lineCoder.unpack(bits)))); } }