¡@

Home 

java Programming Glossary: fis

java get file size efficiently

http://stackoverflow.com/questions/116574/java-get-file-size-efficiently

public long getResult throws Exception FileInputStream fis null try File me new File FileSizeBench.class.getResource .. FileSizeBench.class .getFile fis new FileInputStream me return fis.getChannel .size finally.. .getFile fis new FileInputStream me return fis.getChannel .size finally fis.close URL @Override public..

Appending to an ObjectOutputStream

http://stackoverflow.com/questions/1194656/appending-to-an-objectoutputstream

. To read I am using FileInputStream fis new FileInputStream preferences.getAppDataLocation history ObjectInputStream.. history ObjectInputStream in new ObjectInputStream fis try while true history.add Stuff in.readObject catch Exception..

Using a JFileChooser with Swing GUI classes and listeners

http://stackoverflow.com/questions/15728619/using-a-jfilechooser-with-swing-gui-classes-and-listeners

JTextArea textArea JFileChooser chooser FileInputStream fis BufferedReader br FileOutputStream fos BufferedWriter bwriter.. app JFileChooser.APPROVE_OPTION if obj open try fis new FileInputStream chooser.getSelectedFile br new BufferedReader.. br new BufferedReader new InputStreamReader fis String read StringBuffer text new StringBuffer while read..

Byte order mark screws up file reading in Java

http://stackoverflow.com/questions/1835430/byte-order-mark-screws-up-file-reading-in-java

main final String args throws Exception FileInputStream fis new FileInputStream test offending_bom.txt UnicodeBOMInputStream.. UnicodeBOMInputStream ubis new UnicodeBOMInputStream fis System.out.println detected BOM ubis.getBOM System.out.print.. br.readLine br.close isr.close ubis.close fis.close fis new FileInputStream test offending_bom.txt ubis new..

Convert 4 bytes to int

http://stackoverflow.com/questions/2383265/convert-4-bytes-to-int

a byte array File file new File file.bin FileInputStream fis new FileInputStream file byte arr new byte int file.length fis.read.. new FileInputStream file byte arr new byte int file.length fis.read arr create a byte buffer and wrap the array ByteBuffer..

Windows shortcut (.lnk) parser in Java?

http://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java

IOException final int minimum_length 0x64 InputStream fis file.getContent .getInputStream boolean isPotentiallyValid false.. file.getName .getExtension .toLowerCase .equals lnk fis.available minimum_length isMagicPresent getBytes fis 32 finally.. lnk fis.available minimum_length isMagicPresent getBytes fis 32 finally fis.close return isPotentiallyValid public WindowsShortcut..

Setting the default Java character encoding?

http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding

UTF 8 byte inbytes new byte 1024 FileInputStream fis new FileInputStream response.txt fis.read inbytes FileOutputStream.. 1024 FileInputStream fis new FileInputStream response.txt fis.read inbytes FileOutputStream fos new FileOutputStream response..

Java: checked vs unchecked exception explanation

http://stackoverflow.com/questions/6115896/java-checked-vs-unchecked-exception-explanation

try File file new File my file path FileInputStream fis new FileInputStream file catch FileNotFoundException e 3. What.. file path File file new File filePath FileInputStream fis new FileInputStream file catch FileNotFoundException e Kindly..

Decorator Pattern for IO

http://stackoverflow.com/questions/6366385/decorator-pattern-for-io

quickly. First open an inputstream of it FileInputStream fis new FileInputStream objects.gz We want speeeed so let's buffer.. in memory BufferedInputStream bis new BufferedInputStream fis The file is gzipped so we need to ungzip it GzipInputStream..