/** Returns the length of the file. */ public long length() throws IOException { return outputFile.length(); }
/** * @return the length of the file * @throws IOException if the length cannot be retrieved */ public long length() throws IOException { return outputFile.length(); }
/** * @return the number of bytes in the file. * @throws IOException if the length cannot be retrieved */ public long length() throws IOException { return length < 0 ? raf.length() : length; }
/** * Gets the number of bytes in the file. * * @return the length of the stream in bytes * @throws IOException if the length cannot be retrieved */ public long length() throws IOException { return raf.length(); }
/** Gets the number of bytes in the file. */ public long length() throws IOException { return length < 0 ? raf.length() : length; }
/** Gets the number of bytes in the file. */ public long length() throws IOException { return raf.length(); }
/** Returns true if the given filename is a Zip file. */ public static boolean isZipFile(String file) throws IOException { if (!file.toLowerCase().endsWith(".zip")) return false; IRandomAccess handle = getHandle(file); byte[] b = new byte[2]; if (handle.length() >= 2) { handle.read(b); } handle.close(); return new String(b, Constants.ENCODING).equals("PK"); }
/** Read bytes from the stream into the given array. */ @Override public int read(byte[] array) throws IOException { int rtn = raf.read(array); if (rtn == 0 && raf.getFilePointer() >= raf.length() - 1) rtn = -1; return rtn; }
/** * Read n bytes from the stream into the given array at the specified offset. */ @Override public int read(byte[] array, int offset, int n) throws IOException { int rtn = raf.read(array, offset, n); if (rtn == 0 && raf.getFilePointer() >= raf.length() - 1) rtn = -1; return rtn; }
/** * Read n bytes from the stream into the given array at the specified offset. */ @Override public int read(byte[] array, int offset, int n) throws IOException { int rtn = raf.read(array, offset, n); if (rtn == 0 && raf.getFilePointer() >= raf.length() - 1) rtn = -1; return rtn; }
/** * @param file a name that can be passed to * {@link Location#getHandle(String, boolean, boolean)} * @return true if the given filename is a Zip file. * @throws IOException if the file cannot be read */ public static boolean isZipFile(String file) throws IOException { if (!file.toLowerCase().endsWith(".zip")) return false; IRandomAccess handle = getHandle(file); byte[] b = new byte[2]; if (handle.length() >= 2) { handle.read(b); } handle.close(); return new String(b, Constants.ENCODING).equals("PK"); }
/** Read bytes from the stream into the given array. */ @Override public int read(byte[] array) throws IOException { int rtn = raf.read(array); if (rtn == 0 && raf.getFilePointer() >= raf.length() - 1) rtn = -1; return rtn; }
llength = handle.length(); } catch (IOException e) { LOGGER.trace("Could not determine URL's content length", e);
throw new FormatException(String.format("Expected file cookie of %d, but got %d.", COOKIE, cookie)); long fileLength = is.length();
throw new FormatException(String.format("Expected file cookie of %d, but got %d.", COOKIE, cookie)); long fileLength = is.length();