1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-15 02:36:24 +00:00

Edit document, add files, display files

This commit is contained in:
jendib
2013-07-28 01:07:04 +02:00
parent 9b74bd8194
commit 3a2ffec497
25 changed files with 1811 additions and 421 deletions

View File

@@ -1,7 +1,6 @@
package com.sismics.util.mime;
import java.io.InputStream;
import java.io.PushbackInputStream;
/**
* Utility to check MIME types.
@@ -18,9 +17,9 @@ public class MimeTypeUtil {
*/
public static String guessMimeType(InputStream is) throws Exception {
byte[] headerBytes = new byte[64];
PushbackInputStream pb = new PushbackInputStream(is, headerBytes.length);
int readCount = pb.read(headerBytes);
pb.unread(headerBytes);
is.mark(headerBytes.length);
int readCount = is.read(headerBytes);
is.reset();
if (readCount <= 0) {
throw new Exception("Cannot read input file");