PhotoEntry photoEntry = new PhotoEntry(submissionId,
String.format("%s%d", submissionId, imageCount), partMimeType);
pmfUtil.persistJdo(photoEntry);
Base64DecoderStream base64Stream = (Base64DecoderStream) part.getContent();
int index = 0;
int bytesRead = DataChunk.CHUNK_SIZE;
long fileSize = 0;
while (bytesRead == DataChunk.CHUNK_SIZE) {
byte[] buffer = new byte[DataChunk.CHUNK_SIZE];
bytesRead = base64Stream.read(buffer, 0, DataChunk.CHUNK_SIZE);
fileSize += bytesRead;
if (bytesRead < DataChunk.CHUNK_SIZE) {
buffer = Arrays.copyOf(buffer, bytesRead);
}