| | |
| | | package de.uhilger.wbx; |
| | | |
| | | import de.uhilger.wbx.data.Inhalt; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | |
| | | |
| | | |
| | | public List<Inhalt> collectFiles(String requestUrl, String contextPath, |
| | | String relativePath, int maxTiefe, int maxAnzahl) { |
| | | String relativePath, int maxTiefe, int maxAnzahl, long length) { |
| | | Bild bild = new Bild(); |
| | | //WbxUtils wu = new WbxUtils(); |
| | | String basis = getJNDIParameter(WBX_FILE_BASE, WbxUtils.EMPTY_STRING); |
| | |
| | | return files; |
| | | } |
| | | |
| | | private String getFileContent(File file, long len) { |
| | | try { |
| | | StringBuffer readBuffer = new StringBuffer(); |
| | | byte[] buf = new byte[1024]; |
| | | long read = 0; |
| | | FileInputStream fis = new FileInputStream(file); |
| | | int bytesRead = fis.read(buf); |
| | | read += bytesRead; |
| | | while(read < len) { |
| | | readBuffer.append(buf); |
| | | bytesRead = fis.read(buf); |
| | | read += bytesRead; |
| | | } |
| | | |
| | | readBuffer.append(buf); |
| | | return readBuffer.toString(); |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(WbxUtils.class.getName()).log(Level.SEVERE, null, ex); |
| | | return EMPTY_STRING; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Diese Methode funktioniert nur, wenn entweder ein Ordner uebergeben |