NullBackend.java |
1 /** 2 * Distribution License: 3 * JSword is free software; you can redistribute it and/or modify it under 4 * the terms of the GNU Lesser General Public License, version 2.1 or later 5 * as published by the Free Software Foundation. This program is distributed 6 * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 7 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 * See the GNU Lesser General Public License for more details. 9 * 10 * The License is available on the internet at: 11 * http://www.gnu.org/copyleft/lgpl.html 12 * or by writing to: 13 * Free Software Foundation, Inc. 14 * 59 Temple Place - Suite 330 15 * Boston, MA 02111-1307, USA 16 * 17 * © CrossWire Bible Society, 2014 - 2016 18 */ 19 package org.crosswire.jsword.book.sword; 20 21 import java.io.IOException; 22 import java.util.ArrayList; 23 import java.util.List; 24 25 import org.crosswire.jsword.book.BookException; 26 import org.crosswire.jsword.book.sword.processing.RawTextToXmlProcessor; 27 import org.crosswire.jsword.passage.DefaultKeyList; 28 import org.crosswire.jsword.passage.Key; 29 30 /** 31 * A NullBackend is not attached to resources. 32 * 33 * @see gnu.lgpl.License The GNU Lesser General Public License for details. 34 * @author DM Smith 35 */ 36 public class NullBackend implements Backend { 37 38 public NullBackend() { 39 } 40 41 /* (non-Javadoc) 42 * @see org.crosswire.jsword.book.sword.Backend#getBookMetaData() 43 */ 44 public SwordBookMetaData getBookMetaData() { 45 return null; 46 } 47 48 /* (non-Javadoc) 49 * @see org.crosswire.jsword.book.sword.Backend#decipher(byte[]) 50 */ 51 public void decipher(byte[] data) { 52 } 53 54 /* (non-Javadoc) 55 * @see org.crosswire.jsword.book.sword.Backend#encipher(byte[]) 56 */ 57 public void encipher(byte[] data) { 58 } 59 60 /* (non-Javadoc) 61 * @see org.crosswire.jsword.book.sword.Backend#readIndex() 62 */ 63 public Key readIndex() { 64 return new DefaultKeyList(); 65 } 66 67 /* (non-Javadoc) 68 * @see org.crosswire.jsword.book.sword.Backend#contains(org.crosswire.jsword.passage.Key) 69 */ 70 public boolean contains(Key key) { 71 return false; 72 } 73 74 /* (non-Javadoc) 75 * @see org.crosswire.jsword.book.sword.Backend#getRawText(org.crosswire.jsword.passage.Key) 76 */ 77 public String getRawText(Key key) throws BookException { 78 return ""; 79 } 80 81 /* (non-Javadoc) 82 * @see org.crosswire.jsword.book.sword.Backend#setAliasKey(org.crosswire.jsword.passage.Key, org.crosswire.jsword.passage.Key) 83 */ 84 public void setAliasKey(Key alias, Key source) throws BookException { 85 } 86 87 /* (non-Javadoc) 88 * @see org.crosswire.jsword.book.sword.Backend#size(org.crosswire.jsword.passage.Key) 89 */ 90 public int getRawTextLength(Key key) { 91 return 0; 92 } 93 94 /* (non-Javadoc) 95 * @see org.crosswire.jsword.book.sword.Backend#getGlobalKeyList() 96 */ 97 public Key getGlobalKeyList() throws BookException { 98 return new DefaultKeyList(); 99 } 100 101 /* (non-Javadoc) 102 * @see org.crosswire.jsword.book.sword.Backend#readToOsis(org.crosswire.jsword.passage.Key, org.crosswire.jsword.book.sword.processing.RawTextToXmlProcessor) 103 */ 104 public List readToOsis(Key key, RawTextToXmlProcessor processor) throws BookException { 105 return new ArrayList(); 106 } 107 108 /* (non-Javadoc) 109 * @see org.crosswire.jsword.book.sword.Backend#create() 110 */ 111 public void create() throws IOException, BookException { 112 } 113 114 /* (non-Javadoc) 115 * @see org.crosswire.jsword.book.sword.Backend#isSupported() 116 */ 117 public boolean isSupported() { 118 return true; 119 } 120 121 /* (non-Javadoc) 122 * @see org.crosswire.jsword.book.sword.Backend#isWritable() 123 */ 124 public boolean isWritable() { 125 return false; 126 } 127 128 } 129