throw new InvalidSizePatternException(sizePattern + " is not valid: missing the '-' character between the width and the height");
}
public static ByteArrayOutputStream extractFileFromDoc(ODocument doc) throws DocumentIsNotAFileException, IOException{
if (!docIsAFile(doc)) throw new DocumentIsNotAFileException();
if (!doc.containsField("file")) throw new DocumentIsNotAFileException("the file field does not exist");
ORecordBytes record = null;
try {
record = doc.field("file");
}catch (Exception e){
throw new DocumentIsNotAFileException("The file field exists but does not contains a valid file");
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
record.toOutputStream(out);
return out;
}