本文整理汇总了Java中java.io.IOException.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IOException.toString方法的具体用法?Java IOException.toString怎么用?Java IOException.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.IOException
的用法示例。
在下文中一共展示了IOException.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: play
import java.io.IOException; //导入方法依赖的package包/类
@Override
public void play(Song song) {
reset();
String path = song.getSource().getPath();
try {
setDataSource(path);
mediaPlayer.prepare();
} catch (IOException ioe) {
throw new RuntimeException("Failed to play song:\n" + ioe.toString());
} catch (IllegalStateException ise) {
mediaPlayer.release();
play(song); // retry
}
this.currentSong = song;
mediaPlayer.start();
}
示例2: parseEntity
import java.io.IOException; //导入方法依赖的package包/类
/**
* Parses the specified entity.
*
* @param importLocation
* The source location of the import/include statement.
* Used for reporting errors.
*/
public void parseEntity( InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation )
throws SAXException {
documentSystemId = source.getSystemId();
try {
Schema s = new Schema(this,includeMode,expectedNamespace);
setRootHandler(s);
try {
parser.parser.parse(source,this, getErrorHandler(), parser.getEntityResolver());
} catch( IOException fnfe ) {
SAXParseException se = new SAXParseException(fnfe.toString(), importLocation, fnfe);
parser.errorHandler.warning(se);
}
} catch( SAXException e ) {
parser.setErrorFlag();
throw e;
}
}
示例3: start
import java.io.IOException; //导入方法依赖的package包/类
private static void start()
{
if(sProcess != null)
return;
LogUtils.i("ShellUtils start, root=" + sRoot);
try {
sProcess = Runtime.getRuntime().exec(sRoot ? "su" : "sh");
sInStream = new OutputStreamWriter(sProcess.getOutputStream());
sOutStream = new InputStreamReader(sProcess.getInputStream());
sErrStream = new InputStreamReader(sProcess.getErrorStream());
} catch (IOException e) {
stdErr = "init LogUnit fail:" + e.toString();
LogUtils.e(stdErr, e);
AppModel.fatalError(stdErr);
}
LogUtils.i("ShellUtils is ready");
}
示例4: doEndTag
import java.io.IOException; //导入方法依赖的package包/类
@Override
public int doEndTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
if (!"-1".equals(objectValue)) {
out.print(objectValue);
} else if (!"-1".equals(stringValue)) {
out.print(stringValue);
} else if (longValue != -1) {
out.print(longValue);
} else if (doubleValue != -1) {
out.print(doubleValue);
} else {
out.print("-1");
}
} catch (IOException ex) {
throw new JspTagException("IOException: " + ex.toString(), ex);
}
return super.doEndTag();
}
示例5: normalize
import java.io.IOException; //导入方法依赖的package包/类
private Appendable normalize(CharSequence src, Appendable dest,
UnicodeSet.SpanCondition spanCondition) {
// Don't throw away destination buffer between iterations.
StringBuilder tempDest=new StringBuilder();
try {
for(int prevSpanLimit=0; prevSpanLimit<src.length();) {
int spanLimit=set.span(src, prevSpanLimit, spanCondition);
int spanLength=spanLimit-prevSpanLimit;
if(spanCondition==UnicodeSet.SpanCondition.NOT_CONTAINED) {
if(spanLength!=0) {
dest.append(src, prevSpanLimit, spanLimit);
}
spanCondition=UnicodeSet.SpanCondition.SIMPLE;
} else {
if(spanLength!=0) {
// Not norm2.normalizeSecondAndAppend() because we do not want
// to modify the non-filter part of dest.
dest.append(norm2.normalize(src.subSequence(prevSpanLimit, spanLimit), tempDest));
}
spanCondition=UnicodeSet.SpanCondition.NOT_CONTAINED;
}
prevSpanLimit=spanLimit;
}
} catch(IOException e) {
throw new InternalError(e.toString(), e);
}
return dest;
}
示例6: toString
import java.io.IOException; //导入方法依赖的package包/类
/**
* Converts this stream's accumuated data into a string, translating bytes
* into characters according to the platform's default character encoding.
*
* @return String translated from this stream's accumuated data.
* @throws RuntimeException may be thrown if this output stream has been
* {@link #free() freed}.
*/
public synchronized String toString() {
try {
checkFreed();
} catch (IOException ex) {
throw new RuntimeException(ex.toString());
}
return new String(buf, 0, count);
}
示例7: getEncoded
import java.io.IOException; //导入方法依赖的package包/类
/**
* Return the DER encoded form of the certificate pair.
*
* @return The encoded form of the certificate pair.
* @throws CerticateEncodingException If an encoding exception occurs.
*/
public byte[] getEncoded() throws CertificateEncodingException {
try {
if (encoded == null) {
DerOutputStream tmp = new DerOutputStream();
emit(tmp);
encoded = tmp.toByteArray();
}
} catch (IOException ex) {
throw new CertificateEncodingException(ex.toString());
}
return encoded;
}
示例8: startDocument
import java.io.IOException; //导入方法依赖的package包/类
public void startDocument()
throws SAXException
{
try {
prepare();
} catch ( IOException except ) {
throw new SAXException( except.toString() );
}
// Nothing to do here. All the magic happens in startDocument(String)
}
示例9: DependencyDefinitionParser
import java.io.IOException; //导入方法依赖的package包/类
public DependencyDefinitionParser(String dependencyDefinition, DependencyProperties properties,
ResultRenderer renderer) {
this.properties = properties;
this.renderer = renderer;
final StringBuilder builder = new StringBuilder();
try (final BufferedReader reader = new BufferedReader(new StringReader(dependencyDefinition))) {
String line;
int lineNumber = 0;
int lineNumberOfCurrentLogicalLine = 1;
while ((line = reader.readLine()) != null) {
lineNumber++;
line = line.trim();
if (!line.startsWith("#")) {
builder.append(line);
if (line.endsWith("\\")) {
builder.deleteCharAt(builder.length() - 1).append(' ');
} else {
final String logicalLine = replaceProperties(builder.toString().trim(),
lineNumberOfCurrentLogicalLine);
if (logicalLine.length() > 0) {
parseLine(logicalLine, lineNumberOfCurrentLogicalLine);
}
builder.setLength(0);
lineNumberOfCurrentLogicalLine = lineNumber + 1;
}
}
}
} catch (final IOException e) {
throw new IllegalArgumentException(e.toString());
}
}
示例10: X509CRLEntryImpl
import java.io.IOException; //导入方法依赖的package包/类
/**
* Unmarshals a revoked certificate from its encoded form.
*
* @param derVal the DER value containing the revoked certificate.
* @exception CRLException on parsing errors.
*/
public X509CRLEntryImpl(DerValue derValue) throws CRLException {
try {
parse(derValue);
} catch (IOException e) {
revokedCert = null;
throw new CRLException("Parsing error: " + e.toString());
}
}
示例11: readFile
import java.io.IOException; //导入方法依赖的package包/类
private String readFile(File f) {
try {
return new String(Files.readAllBytes(f.toPath()),
StandardCharsets.UTF_8);
} catch (IOException ex) {
return "error reading " + f + " : " + ex.toString();
}
}
示例12: println
import java.io.IOException; //导入方法依赖的package包/类
public void println() {
try {
write('\n');
} catch (IOException ex) {
throw new RuntimeException(ex.toString());
}
}
示例13: reset
import java.io.IOException; //导入方法依赖的package包/类
/** Resets this to an empty buffer. */
public void reset() {
try {
seek(0);
} catch (IOException e) { // should never happen
throw new RuntimeException(e.toString());
}
file.length = 0;
}
示例14: doAfterBody
import java.io.IOException; //导入方法依赖的package包/类
@Override
public int doAfterBody() throws JspException {
try {
if (i == 3) {
bodyOut.writeOut(bodyOut.getEnclosingWriter());
return SKIP_BODY;
}
pageContext.setAttribute("member", atts[i]);
i++;
return EVAL_BODY_BUFFERED;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
示例15: toString
import java.io.IOException; //导入方法依赖的package包/类
/**
* Converts this writer's accumulated data into a string.
*
* @return String constructed from this writer's accumulated data
* @throws RuntimeException may be thrown if this writer has been
* {@link #free() freed}.
*/
public synchronized String toString() {
try {
checkFreed();
} catch (IOException ex) {
throw new RuntimeException(ex.toString());
}
return new String(buf, 0, count);
}