@Test public void testByteArrayUnwrapping() throws Exception { BdfDictionary d = new BdfDictionary(); d.put("foo", new byte[123]); d.put("bar", new Bytes(new byte[123])); byte[] foo = d.getRaw("foo"); assertEquals(123, foo.length); assertArrayEquals(new byte[123], foo); byte[] bar = d.getRaw("bar"); assertEquals(123, bar.length); assertArrayEquals(new byte[123], bar); }
public byte[] getRaw(String key) throws FormatException { Object o = get(key); if (o instanceof byte[]) return (byte[]) o; if (o instanceof Bytes) return ((Bytes) o).getBytes(); throw new FormatException(); }
BdfDictionary extends TreeMap<String, Object> { public byte[] getRaw(String key) throws FormatException { Object o = get(key); if (o instanceof byte[]) return (byte[]) o; if (o instanceof Bytes) return ((Bytes) o).getBytes(); throw new FormatException(); } }
BdfDictionary extends TreeMap<String, Object> { public byte[] getRaw(String key) throws FormatException { Object o = get(key); if (o instanceof byte[]) return (byte[]) o; if (o instanceof Bytes) return ((Bytes) o).getBytes(); throw new FormatException(); } BdfDictionary();  BdfDictionary(Map<String, ?> m); }
BdfDictionary extends TreeMap<String, Object> { public byte[] getRaw(String key) throws FormatException { Object o = get(key); if (o instanceof byte[]) return (byte[]) o; if (o instanceof Bytes) return ((Bytes) o).getBytes(); throw new FormatException(); } BdfDictionary();  BdfDictionary(Map<String, ?> m); static BdfDictionary of(Entry<String, ?>... entries); Boolean getBoolean(String key); @Nullable Boolean getOptionalBoolean(String key); Boolean getBoolean(String key, Boolean defaultValue); Long getLong(String key); @Nullable Long getOptionalLong(String key); Long getLong(String key, Long defaultValue); Double getDouble(String key); @Nullable Double getOptionalDouble(String key); Double getDouble(String key, Double defaultValue); String getString(String key); @Nullable String getOptionalString(String key); String getString(String key, String defaultValue); byte[] getRaw(String key); @Nullable byte[] getOptionalRaw(String key); byte[] getRaw(String key, byte[] defaultValue); BdfList getList(String key); @Nullable BdfList getOptionalList(String key); BdfList getList(String key, BdfList defaultValue); BdfDictionary getDictionary(String key); @Nullable BdfDictionary getOptionalDictionary(String key); BdfDictionary getDictionary(String key, BdfDictionary defaultValue); }
BdfDictionary extends TreeMap<String, Object> { public byte[] getRaw(String key) throws FormatException { Object o = get(key); if (o instanceof byte[]) return (byte[]) o; if (o instanceof Bytes) return ((Bytes) o).getBytes(); throw new FormatException(); } BdfDictionary();  BdfDictionary(Map<String, ?> m); static BdfDictionary of(Entry<String, ?>... entries); Boolean getBoolean(String key); @Nullable Boolean getOptionalBoolean(String key); Boolean getBoolean(String key, Boolean defaultValue); Long getLong(String key); @Nullable Long getOptionalLong(String key); Long getLong(String key, Long defaultValue); Double getDouble(String key); @Nullable Double getOptionalDouble(String key); Double getDouble(String key, Double defaultValue); String getString(String key); @Nullable String getOptionalString(String key); String getString(String key, String defaultValue); byte[] getRaw(String key); @Nullable byte[] getOptionalRaw(String key); byte[] getRaw(String key, byte[] defaultValue); BdfList getList(String key); @Nullable BdfList getOptionalList(String key); BdfList getList(String key, BdfList defaultValue); BdfDictionary getDictionary(String key); @Nullable BdfDictionary getOptionalDictionary(String key); BdfDictionary getDictionary(String key, BdfDictionary defaultValue); static final Object NULL_VALUE; }