io.advantageous.boon.core.Exceptions.handle()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中io.advantageous.boon.core.Exceptions.handle()方法的一些代码示例,展示了Exceptions.handle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exceptions.handle()方法的具体详情如下:
包路径:io.advantageous.boon.core.Exceptions
类名称:Exceptions
方法名:handle

Exceptions.handle介绍

暂无

代码示例

代码示例来源:origin: advantageous/qbit

private static byte[] readResponseBodyAsBytes(HttpURLConnection http) {
  try {
    return IO.input(http.getInputStream());
  } catch (IOException e) {
    return Exceptions.handle(byte[].class, e);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static Class<?> toClass(String str) {
  try {
    return Class.forName(str);
  } catch (ClassNotFoundException ex) {
    return (Class<?>) Exceptions.handle(Object.class, ex);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static char[] readCharBuffer( Reader reader, int size ) {
  char[] buffer = new char[ size ];
  try ( Reader r = reader ) {
    reader.read( buffer );
  } catch ( Exception ex ) {
    return Exceptions.handle( char[].class, ex );
  }
  return buffer;
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void move(Path source, Path target) {
  try {
    Files.move(source, target);
  } catch (IOException e) {
    Exceptions.handle(e);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

@Override
public void setStaticValue(Object newValue) {
  try {
    field.set(null, newValue);
  } catch (IllegalAccessException e) {
    Exceptions.handle(e);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void write( OutputStream out, String content, Charset charset ) {
  try ( OutputStream o = out ) {
    o.write( content.getBytes( charset ) );
  } catch ( Exception ex ) {
    Exceptions.handle( ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void writeNoClose( OutputStream out, String content ) {
  try {
    out.write( content.getBytes( DEFAULT_CHARSET ) );
  } catch ( Exception ex ) {
    Exceptions.handle( ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void _idx( final byte[] output, int ouputStartIndex, byte[] input, int inputOffset, int length ) {
  try {
    System.arraycopy( input, inputOffset, output, ouputStartIndex, length );
  } catch ( Exception ex ) {
    Exceptions.handle( String.format( "array size %d, startIndex %d, input length %d",
        output.length, ouputStartIndex, input.length ), ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-json

@Override
public void serialize(CharBuf builder, Object obj) {
  level = 0;
  try {
    serializeObject( obj, builder );
  } catch ( Exception ex ) {
     Exceptions.handle("unable to serializeObject", ex);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void getFields( Class<? extends Object> theClass,
               List<Field> list ) {
  try {
    List<Field> more = getFields( theClass );
    list.addAll( more );
  }catch (Exception ex) {
    Exceptions.handle(ex, "getFields", theClass, list);
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static CharBuf read( InputStream inputStream, CharBuf charBuf, Charset charset, int bufSize, char[] copyBuf ) {
  try ( Reader reader = new InputStreamReader( inputStream, charset ) ) {
    return read( reader, charBuf, bufSize, copyBuf );
  } catch ( Exception ex ) {
    return Exceptions.handle( CharBuf.class, ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static String read( File file ) {
  try ( Reader reader = new FileReader( file ) ) {
    return read( reader );
  } catch ( Exception ex ) {
    return Exceptions.handle( String.class, ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void eachLine( Reader reader, EachLine eachLine ) {
  try ( BufferedReader bufferedReader = new BufferedReader( reader ) ) {
    eachLine( bufferedReader, eachLine );
  } catch ( Exception ex ) {
    Exceptions.handle( List.class, ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static List<String> readLines( InputStream is ) {
  try ( Reader reader = new InputStreamReader( is, DEFAULT_CHARSET ) ) {
    return readLines( reader );
  } catch ( Exception ex ) {
    return Exceptions.handle( List.class, ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void eachLine( BufferedReader reader, EachLine eachLine ) {
  try ( BufferedReader bufferedReader = reader ) {
    String line;
    int lineNumber = 0;
    while ( ( line = bufferedReader.readLine() ) != null &&
        eachLine.line( line, lineNumber++ ) ) { //
      // no op
    }
  } catch ( Exception ex ) {
    Exceptions.handle( ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void createDirectories(String path) {
  try {
    Files.createDirectories(path(path));
  } catch (IOException e) {
    Exceptions.handle(e);
  }
}

代码示例来源:origin: com.github.advantageous/boon-json

@Override
public void toJson( Object value, Appendable appendable ) {
  try {
    appendable.append ( this.writeValueAsString ( value )  );
  } catch ( IOException e ) {
    Exceptions.handle ( e );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public static void writeChild( Path parentDir, String childFileName, String childContents ) {
  try {
    final Path newFilePath = path( parentDir.toString(),
        childFileName );
    write( newFilePath, childContents );
  } catch ( Exception ex ) {
    Exceptions.handle( ex );
  }
}

代码示例来源:origin: io.advantageous.boon/boon-json

public final CharBuf serialize( Object obj ) {
  builder.readForRecycle ();
  try {
    serializeObject( obj, builder );
  } catch ( Exception ex ) {
    return Exceptions.handle(CharBuf.class, "unable to serializeObject", ex);
  }
  return builder;
}

代码示例来源:origin: io.advantageous.boon/boon-reflekt

public final boolean getBoolean( Object obj ) {
  try {
    return ( Boolean ) this.getObject ( obj );
  } catch ( Exception e ) {
    return Exceptions.handle( boolean.class, Str.sputs("unable to call getObject for property", this.name), e );
  }
}

相关文章