Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.    public static char[] lerIntervalo(int min, int max) throws IOException{
  2.         char[] cBuffer;
  3.         BufferedReader leitorTexto = null;
  4.         FileInputStream inputStream = null;
  5.         try {
  6.             inputStream = new FileInputStream(DIRETORIO+ARQUIVO);
  7.             //inputStream.getChannel().position(min);
  8.             inputStream.getChannel().position(min);
  9.             leitorTexto = new BufferedReader(new InputStreamReader(inputStream));
  10.             cBuffer = new char[inputStream.available()];
  11.             leitorTexto.read(cBuffer,min,max);
  12.             return cBuffer;
  13.         } catch(IOException e){
  14.             e.printStackTrace();
  15.         } finally {
  16.             try {
  17.                 leitorTexto.close();
  18.             } catch(IOException e){
  19.                 e.printStackTrace();
  20.             }
  21.         }
  22.         return null;
  23.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement