Java 8 IOException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IOException class.

This code example shows how to use the following methods:getMessage
  { 
    try { 
      return IndexIO.loadIndex(parentDir);
    } 
    catch (IOException e) {
      log.warn(e, "Got exception!!!! Going to delete parentDir[%s]", parentDir);
      try { 
        FileUtils.deleteDirectory(parentDir);
      } 
      catch (IOException e2) {
        log.error(e, "Problem deleting parentDir[%s]", parentDir);
      } 
      throw new SegmentLoadingException(e, "%s", e.getMessage());
    } 
  } 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    @Override 
    protected void readHeader(IndexInput in) throws IOException {
        byte[] header = new byte[LZFCompressor.LUCENE_HEADER.length];
        in.readBytes(header, 0, header.length, false);
        if (!Arrays.equals(header, LZFCompressor.LUCENE_HEADER)) {
            throw new IOException("wrong lzf compressed header [" + Arrays.toString(header) + "]");
        } 
    } 
 
    @Override 
    protected int uncompress(IndexInput in, byte[] out) throws IOException {
        return decoder.decodeChunk(new InputStreamIndexInput(in, Long.MAX_VALUE), inputBuffer, out);
    } 
 
    @Override 
    protected void doClose() throws IOException { 
        // nothing to do here... 
    } 
 
    @Override 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:toString
    df.parseExecResult(reader);
    try { 
      df.parseOutput();
      fail("Expected exception with missing line!"); 
    } catch (IOException e) {
      GenericTestUtils.assertExceptionContains( 
          "Fewer lines of output than expected", e);
      System.out.println(e.toString());
    } 
     
    reader = new BufferedReader(new StringReader(
        "Filesystem     1K-blocks     Used Available Use% Mounted on\n" + 
        " ")); 
    df.parseExecResult(reader);
    try { 
      df.parseOutput();
      fail("Expected exception with empty line!"); 
    } catch (IOException e) {
      GenericTestUtils.assertExceptionContains("Unexpected empty line", e);
      System.out.println(e.toString());

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:initCause, setStackTrace
  throws IOException { 
    String decodedFileName = null;
    try { 
      decodedFileName = URLDecoder.decode(logFileName, "UTF-8");
    } catch (UnsupportedEncodingException uee) {
      IOException ioe = new IOException();
      ioe.initCause(uee);
      ioe.setStackTrace(uee.getStackTrace());
      throw ioe;
    } 
    return decodedFileName;
  } 
   
  static String nonOccursString(String logFileName) {
    int adHocIndex = 0;
 
    String unfoundString = "q" + adHocIndex;
 
    while (logFileName.contains(unfoundString)) {
      unfoundString = "q" + ++adHocIndex;
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:initCause
    if (writableClass != null)
      return writableClass.asSubclass(Writable.class);
    try { 
      return conf.getClassByName(name);
    } catch (ClassNotFoundException e) {
      IOException newE = new IOException("WritableName can't load class: " + name);
      newE.initCause(e);
      throw newE;
    } 
  } 
 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
            // and draw 
            content.draw(canvas);
 
            return Status.SUCCESS.createResult(image);
        } catch (IOException e) {
            return ERROR_UNKNOWN.createResult(e.getMessage(), e);
        } 
    } 
 
    protected BufferedImage getImage(int w, int h) {
        BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
        Graphics2D gc = image.createGraphics();
        gc.setComposite(AlphaComposite.Src);
 
        gc.setColor(new Color(0x00000000, true));
        gc.fillRect(0, 0, w, h);
 
        // done 
        gc.dispose();
 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
    public void surfaceCreated(SurfaceHolder holder) {
        try { 
            mCamera.setPreviewDisplay(holder);
            mCamera.startPreview();
        } catch (IOException e) {
            Log.d(TAG, "Error setting camera preview: " + e.getMessage());
        } 
    } 
 
    public void surfaceDestroyed(SurfaceHolder holder) {
    } 
     
 
    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
 
        if (mHolder.getSurface() == null){
          return; 
        } 
 
        try { 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:d, getMessage
        try { 
            file = new RandomAccessFile(imagePath, "r");
            return BitmapFactory.decodeFileDescriptor(file.getFD(), null,
                    options);
        } catch (IOException e) {
            Log.d(TAG, e.getMessage(), e);
            return null; 
        } finally { 
            if (file != null)
                try { 
                    file.close();
                } catch (IOException e) {
                    Log.d(TAG, e.getMessage(), e);
                } 
        } 
    } 
 
    /** 
     * Get a bitmap from the image 
     * 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
            handles.put(handle, s);
            return s;
        } else if (b == 1) {
            return handles.get(in.readVInt());
        } else { 
            throw new IOException("Expected handle header, got [" + b + "]");
        } 
    } 
 
    @Override 
    public String readString() throws IOException {
        return in.readString(); 
    } 
 
    @Override 
    public Text readSharedText() throws IOException {
        byte b = in.readByte();
        if (b == 0) {
            int handle = in.readVInt();
            Text s = in.readText();
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    assertEquals("`" + path + "': Input/output error", pe.getMessage()); 
  } 
 
  @Test 
  public void testWithThrowable() throws Exception { 
    IOException ioe = new IOException("KABOOM");     
    PathIOException pe = new PathIOException(path, ioe); 
    assertEquals(new Path(path), pe.getPath()); 
    assertEquals("`" + path + "': Input/output error: " + error, pe.getMessage()); 
  } 
 
  @Test 
  public void testWithCustomString() throws Exception { 
    PathIOException pe = new PathIOException(path, error); 
    assertEquals(new Path(path), pe.getPath()); 
    assertEquals("`" + path + "': " + error, pe.getMessage()); 
  } 
   
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Java 8 IOException Questions & Answers:

Other Java 8 IOException Examples

52:	          try {
53:	            stream.close();
54:	          } catch (IOException e) {
55:	            e.printStackTrace();
56:	          }

Read More

20:	      try {
21:	        reader.close();
22:	      } catch (IOException e) {
23:	        e.printStackTrace();
24:	      }

Read More

40:	    try {
41:	      audiofile = File.createTempFile("sound", ".3gp", sampleDir);
42:	    } catch (IOException e) {
43:	      Log.e(TAG, "sdcard access error");
44:	      return;

Read More

26:				e.printStackTrace();
27:			} catch (IOException e) {
28:				e.printStackTrace();
29:			}
30:		}

Read More

15:					Log.e("Error: ", e.getMessage());
16:		            return null;
17:				} catch (IOException e) {
18:					Log.e("Error: ", e.getMessage());
19:					return null;

Read More

9:				@Override
10:				public void onIOException(IOException e, Object state) {
11:				}
12:	
13:				@Override

Read More

See Code Examples for Java 8 IOException Methods: