@Test public void testDetectZeroValue() { byte[] data = "".getBytes(UTF_8); detect(data, MediaType.EMPTY); }
public MediaType detect(InputStream stream, Metadata metadata) throws IOException { if (stream != null) { try { stream.mark(1); if (stream.read() == -1) { return MediaType.EMPTY; } } finally { stream.reset(); } } return MediaType.OCTET_STREAM; }
ZeroSizeFileDetector implements Detector { public MediaType detect(InputStream stream, Metadata metadata) throws IOException { if (stream != null) { try { stream.mark(1); if (stream.read() == -1) { return MediaType.EMPTY; } } finally { stream.reset(); } } return MediaType.OCTET_STREAM; } }
ZeroSizeFileDetector implements Detector { public MediaType detect(InputStream stream, Metadata metadata) throws IOException { if (stream != null) { try { stream.mark(1); if (stream.read() == -1) { return MediaType.EMPTY; } } finally { stream.reset(); } } return MediaType.OCTET_STREAM; }  }
ZeroSizeFileDetector implements Detector { public MediaType detect(InputStream stream, Metadata metadata) throws IOException { if (stream != null) { try { stream.mark(1); if (stream.read() == -1) { return MediaType.EMPTY; } } finally { stream.reset(); } } return MediaType.OCTET_STREAM; }  MediaType detect(InputStream stream, Metadata metadata); }
ZeroSizeFileDetector implements Detector { public MediaType detect(InputStream stream, Metadata metadata) throws IOException { if (stream != null) { try { stream.mark(1); if (stream.read() == -1) { return MediaType.EMPTY; } } finally { stream.reset(); } } return MediaType.OCTET_STREAM; }  MediaType detect(InputStream stream, Metadata metadata);  }