Decodes the {@link Storage}.

@return the decoded {@link Storage}.
@see #encodeTypeAndStorage(CounterConfiguration)
778674
public static CounterType decodeType(byte flags) {
      switch (flags & 0x03) {
         case WEAK_COUNTER:
            return CounterType.WEAK;
         case BOUNDED_COUNTER:
            return CounterType.BOUNDED_STRONG;
         case UNBOUNDED_COUNTER:
            return CounterType.UNBOUNDED_STRONG;
         default:
            throw log.invalidCounterTypeEncoded();
      }
   }
617694
public StorageComponent<KeyType, ValueType> getStorageComponent(final KeyType key) {

        KeyToStorageComponent<KeyType, ValueType> storage = getkeyToStorage();
        StorageComponent<KeyType, ValueType> storageComponent = storage.get(key);
        if (storageComponent == null) {
            storageComponent = new StorageComponent<KeyType, ValueType>();
            storage.put(key, storageComponent);
        }
        return storageComponent;
    }
402943
public final Object decode(CachedData d) {
    Object obj = d.decodedObject;
    if (obj != null) {
      return obj;
    }
    byte[] data = d.data;

    int flags = d.flag;
    if ((flags & COMPRESSED) != 0) {
      data = decompress(data);
    }
    flags = flags & SPECIAL_MASK;
    obj = decode0(d, data, flags);
    d.decodedObject = obj;
    return obj;
  }
390233
public static Long decodeLongObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int b = src[srcOffset];
            if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
                return null;
            }
            return decodeLong(src, srcOffset + 1);
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
995647
private DB openStorage(StorageType storageType) {
        DB storage = storageRegistry.get(storageType);
        if(!isOpenStorage(storage)) {
            DBMaker m;
            if(storageType == StorageType.PRIMARY_STORAGE || storageType == StorageType.SECONDARY_STORAGE) {
                //main storage
                Path rootPath = getRootPath(storageName);
                try {
                    createDirectoryIfNotExists(rootPath);
                }
                catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }

                m = DBMaker.newFileDB(new File(rootPath.toFile(), storageType.toString()));
            }
            else if(storageType == StorageType.TEMP_PRIMARY_STORAGE || storageType == StorageType.TEMP_SECONDARY_STORAGE) {
                //temporary storage
                m = DBMaker.newTempFileDB().deleteFilesAfterClose();
            }
            else {
                throw new IllegalArgumentException("Unsupported StorageType.");
            }
            
            if(storageConfiguration.isCompressed()) {
                m = m.compressionEnable();
            }

            boolean permitCaching = storageType == StorageType.PRIMARY_STORAGE || storageType == StorageType.TEMP_PRIMARY_STORAGE;
            if(permitCaching && storageConfiguration.getCacheSize()>0) {
                m = m.cacheLRUEnable().cacheSize(storageConfiguration.getCacheSize()) ;
            }
            else {
                m = m.cacheDisable();
            }

            if(storageConfiguration.isAsynchronous()) {
                m = m.asyncWriteEnable();
            }
            
            m = m.transactionDisable();
            
            m = m.closeOnJvmShutdown();
            
            storage = m.make();
            storageRegistry.put(storageType, storage);
        }
        return storage;
    }
672363
public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) {
      if (encoder == null || wrapper == null) {
         throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!");
      }
      if (stored == null) return null;
      return encoder.fromStorage(wrapper.unwrap(stored));
   }
64766
private int decodeNextBWTByte() {
        int mergedPointer = bwtCurrentMergedPointer;
        int nextDecodedByte =  mergedPointer & 0xff;
        bwtCurrentMergedPointer = bwtMergedPointers[mergedPointer >>> 8];

        if (blockRandomised) {
            if (--randomCount == 0) {
                nextDecodedByte ^= 1;
                randomIndex = (randomIndex + 1) % 512;
                randomCount = Bzip2Rand.rNums(randomIndex);
            }
        }
        bwtBytesDecoded++;

        return nextDecodedByte;
    }
1298329
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.chunksWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.chunkBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.totalBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        return bufferIndex - start;
    }
1023895
public byte[] getEncoded() throws CertificateEncodingException {
        try {
            if (encoded == null) {
                DerOutputStream tmp = new DerOutputStream();
                emit(tmp);
                encoded = tmp.toByteArray();
            }
        } catch (IOException ex) {
            throw new CertificateEncodingException(ex.toString());
        }
        return encoded;
    }
427862
public byte[] getEncodedInternal() throws IOException {
        if (encoded == null) {
            DerOutputStream     out = new DerOutputStream();
            DerOutputStream     tmp = new DerOutputStream();
            for (int i = 0; i < names.length; i++) {
                names[i].encode(tmp);
            }
            out.write(DerValue.tag_Sequence, tmp);
            encoded = out.toByteArray();
        }
        return encoded;
    }
754515
public byte[] decodeBinary() throws IOException {
		final int length = decodeUnsignedInteger();
		byte[] result = new byte[length];

		int readBytes = 0;
		while (readBytes < length) {
			int len = is.read(result, readBytes, length - readBytes);
			if (len == -1) {
				throw new EOFException(
						"Premature EOS found while reading data.");
			}
			readBytes += len;
		}

		// int readBytes = is.read(result);
		// if (readBytes < length) {
		// // special case: not all bytes are read
		// while ((readBytes += is.read(result, readBytes, length - readBytes))
		// < length) {
		// }
		// }

		return result;
	}
1301822
private MtasSolrCollectionCacheItem decode(String s) throws IOException {
    byte[] bytes = Base64.base64ToByteArray(s);
    ObjectInputStream objectInputStream;
    objectInputStream = new ObjectInputStream(new ByteArrayInputStream(bytes));
    try {
      Object o = objectInputStream.readObject();
      if (o instanceof MtasSolrCollectionCacheItem) {
        return (MtasSolrCollectionCacheItem) o;
      } else {
        throw new IOException("unexpected " + o.getClass().getSimpleName());
      }
    } catch (ClassNotFoundException e) {
      throw new IOException(e);
    }
  }
1161271
public static Double decodeDoubleObjDesc(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        long bits = DataDecoder.decodeDoubleBits(src, srcOffset);
        if (bits >= 0) {
            bits ^= 0x7fffffffffffffffL;
        }
        return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
    }
1207841
public byte[] keyToStorageFormat(byte[] key) {

        switch(getReadOnlyStorageFormat()) {
            case READONLY_V0:
            case READONLY_V1:
                return ByteUtils.md5(key);
            case READONLY_V2:
                return ByteUtils.copy(ByteUtils.md5(key), 0, 2 * ByteUtils.SIZE_OF_INT);
            default:
                throw new VoldemortException("Unknown read-only storage format");
        }
    }
474711
public byte[] encode() {
		char type = getAttributeType();
		byte binValue[] = new byte[HEADER_LENGTH + getDataLength()];

		// Type
		binValue[0] = (byte) (type >> 8);
		binValue[1] = (byte) (type & 0x00FF);

		// Length
		binValue[2] = (byte) (getDataLength() >> 8);
		binValue[3] = (byte) (getDataLength() & 0x00FF);

		return binValue;
	}
804079
byte[] encodeToBytes(EncodingLevel encodingLevel) throws JMSException {

        // If we haven't already got the encoding cached, encode & cache it now.
        if (cachedEncoding[encodingLevel.ordinal()] == null) {
            cachedEncoding[encodingLevel.ordinal()] = destEncoder.getMessageRepresentationFromDest(this, encodingLevel);
        }
        return cachedEncoding[encodingLevel.ordinal()];
    }
984588
public static String encode(final String decoded, final String charset) 
        throws UnsupportedEncodingException {
        return s_codec.encode(decoded, charset);
    }