本文整理汇总了Java中org.apache.commons.math.MathRuntimeException.createEOFException方法的典型用法代码示例。如果您正苦于以下问题:Java MathRuntimeException.createEOFException方法的具体用法?Java MathRuntimeException.createEOFException怎么用?Java MathRuntimeException.createEOFException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.MathRuntimeException
的用法示例。
在下文中一共展示了MathRuntimeException.createEOFException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Computes the empirical distribution using data read from a URL.
* @param url url of the input file
*
* @throws IOException if an IO error occurs
*/
public void load(URL url) throws IOException {
BufferedReader in =
new BufferedReader(new InputStreamReader(url.openStream()));
try {
DataAdapter da = new StreamDataAdapter(in);
da.computeStats();
if (sampleStats.getN() == 0) {
throw MathRuntimeException.createEOFException("URL {0} contains no data",
url);
}
in = new BufferedReader(new InputStreamReader(url.openStream()));
fillBinStats(in);
loaded = true;
} finally {
try {
in.close();
} catch (IOException ex) {
// ignore
}
}
}
示例2: load
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Computes the empirical distribution using data read from a URL.
* @param url url of the input file
*
* @throws IOException if an IO error occurs
* @throws NullArgumentException if url is null
*/
public void load(URL url) throws IOException, NullArgumentException {
MathUtils.checkNotNull(url);
BufferedReader in =
new BufferedReader(new InputStreamReader(url.openStream()));
try {
DataAdapter da = new StreamDataAdapter(in);
da.computeStats();
if (sampleStats.getN() == 0) {
throw MathRuntimeException.createEOFException(LocalizedFormats.URL_CONTAINS_NO_DATA,
url);
}
in = new BufferedReader(new InputStreamReader(url.openStream()));
fillBinStats(in);
loaded = true;
} finally {
try {
in.close();
} catch (IOException ex) {
// ignore
}
}
}
示例3: load
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Computes the empirical distribution using data read from a URL.
* @param url url of the input file
*
* @throws IOException if an IO error occurs
*/
public void load(URL url) throws IOException {
BufferedReader in =
new BufferedReader(new InputStreamReader(url.openStream()));
try {
DataAdapter da = new StreamDataAdapter(in);
try {
da.computeStats();
} catch (IOException ioe) {
// don't wrap exceptions which are already IOException
throw ioe;
} catch (RuntimeException rte) {
// don't wrap RuntimeExceptions
throw rte;
} catch (Exception e) {
throw MathRuntimeException.createIOException(e);
}
if (sampleStats.getN() == 0) {
throw MathRuntimeException.createEOFException("URL {0} contains no data",
url);
}
in = new BufferedReader(new InputStreamReader(url.openStream()));
fillBinStats(in);
loaded = true;
} finally {
try {
in.close();
} catch (IOException ex) {
// ignore
}
}
}
示例4: getNextReplay
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Gets next sequential value from the <code>valuesFileURL</code>.
* <p>
* Throws an IOException if the read fails.</p>
* <p>
* This method will open the <code>valuesFileURL</code> if there is no
* replay file open.</p>
* <p>
* The <code>valuesFileURL</code> will be closed and reopened to wrap around
* from EOF to BOF if EOF is encountered. EOFException (which is a kind of
* IOException) may still be thrown if the <code>valuesFileURL</code> is
* empty.</p>
*
* @return next value from the replay file
* @throws IOException if there is a problem reading from the file
* @throws NumberFormatException if an invalid numeric string is
* encountered in the file
*/
private double getNextReplay() throws IOException {
String str = null;
if (filePointer == null) {
resetReplayFile();
}
if ((str = filePointer.readLine()) == null) {
// we have probably reached end of file, wrap around from EOF to BOF
closeReplayFile();
resetReplayFile();
if ((str = filePointer.readLine()) == null) {
throw MathRuntimeException.createEOFException("URL {0} contains no data",
valuesFileURL);
}
}
return Double.valueOf(str).doubleValue();
}
示例5: getNextReplay
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* Gets next sequential value from the <code>valuesFileURL</code>.
* <p>
* Throws an IOException if the read fails.</p>
* <p>
* This method will open the <code>valuesFileURL</code> if there is no
* replay file open.</p>
* <p>
* The <code>valuesFileURL</code> will be closed and reopened to wrap around
* from EOF to BOF if EOF is encountered. EOFException (which is a kind of
* IOException) may still be thrown if the <code>valuesFileURL</code> is
* empty.</p>
*
* @return next value from the replay file
* @throws IOException if there is a problem reading from the file
* @throws NumberFormatException if an invalid numeric string is
* encountered in the file
*/
private double getNextReplay() throws IOException {
String str = null;
if (filePointer == null) {
resetReplayFile();
}
if ((str = filePointer.readLine()) == null) {
// we have probably reached end of file, wrap around from EOF to BOF
closeReplayFile();
resetReplayFile();
if ((str = filePointer.readLine()) == null) {
throw MathRuntimeException.createEOFException(LocalizedFormats.URL_CONTAINS_NO_DATA,
valuesFileURL);
}
}
return Double.valueOf(str).doubleValue();
}