src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -26,10 +26,11 @@
package com.sun.xml.internal.org.jvnet.mimepull;
import java.nio.ByteBuffer;
import java.io.File;
import java.io.IOException;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Keeps the Part's partial content data in memory.
*
@@ -48,28 +49,32 @@
len = buf.limit();
this.config = config;
}
// size of the chunk given by the parser
+ @Override
public int size() {
return len;
}
+ @Override
public byte[] read() {
return data;
}
+ @Override
public long writeTo(DataFile file) {
return file.writeTo(data, 0, len);
}
/**
*
* @param dataHead
* @param buf
* @return
*/
+ @Override
public Data createNext(DataHead dataHead, ByteBuffer buf) {
if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) {
try {
String prefix = config.getTempFilePrefix();
String suffix = config.getTempFileSuffix();
@@ -77,11 +82,11 @@
File tempFile = (dir == null)
? File.createTempFile(prefix, suffix)
: File.createTempFile(prefix, suffix, dir);
// delete the temp file when VM exits as a last resort for file clean up
tempFile.deleteOnExit();
- LOGGER.fine("Created temp file = "+tempFile);
+ if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);}
dataHead.dataFile = new DataFile(tempFile);
} catch(IOException ioe) {
throw new MIMEParsingException(ioe);
}