@Test void testGetResourceAsStream() { ByteArrayResource resource = new ByteArrayResource("mylocation", new byte[0]); assertTrue(resource.getResourceAsStream("mylocation") instanceof ByteArrayInputStream); assertNull(resource.getResourceAsStream("notmylocation")); }
@Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location != null && location.equals(this.location)) { result = new ByteArrayInputStream(bytes); } return result; }
ByteArrayResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location != null && location.equals(this.location)) { result = new ByteArrayInputStream(bytes); } return result; } }
ByteArrayResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location != null && location.equals(this.location)) { result = new ByteArrayInputStream(bytes); } return result; } ByteArrayResource(String location, byte[] bytes); }
ByteArrayResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location != null && location.equals(this.location)) { result = new ByteArrayInputStream(bytes); } return result; } ByteArrayResource(String location, byte[] bytes); @Override Stream<String> getAllLocations(); byte[] getBytes(); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); }
ByteArrayResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location != null && location.equals(this.location)) { result = new ByteArrayInputStream(bytes); } return result; } ByteArrayResource(String location, byte[] bytes); @Override Stream<String> getAllLocations(); byte[] getBytes(); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location);  }