ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace();
ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace();
exp.printStackTrace(); } finally { stream.close();
public KieSession loadSession( FileInputStream input ) throws IOException, ClassNotFoundException { KieSession ksession = null; DroolsObjectInputStream droolsIn = new DroolsObjectInputStream( input, this.getClass().getClassLoader() ); try { KieBase kbase = (KieBase) droolsIn.readObject(); Marshaller mas = createMarshaller( kbase ); ksession = mas.unmarshall(droolsIn); } catch ( EOFException e ) { e.printStackTrace(); fail( e.getMessage() ); } finally { droolsIn.close(); } return ksession; }
public final void readURL(URLConnection url) throws IOException { DataInputStream in = new DataInputStream(url.getInputStream()); printHeader(url); try { while (true) { System.out.println((char) in.readUnsignedByte()); } } catch (EOFException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public static <T> TreeMap<String, T> load(XStream xstream, Class<T> clazz, String xmlPath) { TreeMap<String, T> result = new TreeMap<String, T>(); try { File inputPath = new File(xmlPath); if (!inputPath.exists()) { throw new FileNotFoundException(inputPath.getPath()); } for (File file : listXMLFiles(inputPath)) { InputStreamReader reader = new InputStreamReader(new FileInputStream(file.getAbsoluteFile())); result.put(file.getName(), clazz.cast(xstream.fromXML(reader))); reader.close(); } } catch (EOFException e) { e.printStackTrace(); // TODO: check if this is supposed to be within the for loop! } catch (Exception e) { throw new Error(e); } return result; }
/** * Create RelatedUsersWritable from input stream. * * @param in input stream * @throws IOException - */ public void readFields(final DataInput in) throws IOException { try { int listSize = in.readInt(); this.relatedUsers= new ArrayList<LongWritable>(listSize); for(int i=0; i<listSize; i++) { long userID = in.readLong(); this.relatedUsers.add(new LongWritable(userID)); } } catch (EOFException e) { e.printStackTrace(); } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); } }
e.printStackTrace(); }catch (ClassNotFoundException e){ e.printStackTrace();
public static ShortcutSerializableData loadSerializedShortcutData(){ ObjectInputStream inputStram = null; try{ inputStram = new ObjectInputStream(MainActivity.activity.openFileInput("shortcutdata")); Object obj = inputStram.readObject(); if (obj instanceof ShortcutSerializableData){ return (ShortcutSerializableData)obj; }else return null; }catch (EOFException e){ e.printStackTrace(); }catch (ClassNotFoundException e){ e.printStackTrace(); }catch (FileNotFoundException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); }finally{ try{ if (inputStram!=null){ inputStram.close(); } }catch (IOException e){ e.printStackTrace(); } } return null; }
static boolean isPlaintext(Buffer buffer) { try { Buffer prefix = new Buffer(); long byteCount = buffer.size() < 64 ? buffer.size() : 64; buffer.copyTo(prefix, 0, byteCount); for (int i = 0; i < 16; i++) { if (prefix.exhausted()) { break; } int codePoint = prefix.readUtf8CodePoint(); if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) { return false; } } return true; } catch (EOFException e) { e.printStackTrace(); return false; } } }
synchronized byte[] get() { if(buffer.size() == 0) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } byte[] dst; if(buffer.size() <= MAX_BULK_BUFFER){ dst = buffer.readByteArray(); }else{ try { dst = buffer.readByteArray(MAX_BULK_BUFFER); } catch (EOFException e) { e.printStackTrace(); return new byte[0]; } } if(debugging) UsbSerialDebugger.printLogGet(dst, true); return dst; } }
/** * Returns how many rows we fetched with nextBuffer(). It only means how many rows * are read by nextBuffer(). The returned result may be smaller than actual number * of rows passed by, because {@link #seek(long)} can change the underlying key buffer and * value buffer. * * @return next row number * @throws IOException */ public boolean nextBuffer(LongWritable readRows) throws IOException { if (readRowsIndexInBuffer < recordsNumInValBuffer) { readRows.set(passedRowsNum); readRowsIndexInBuffer++; passedRowsNum++; rowFetched = false; return true; } else { keyInit = false; } int ret = -1; try { ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace(); } return (ret > 0) && nextBuffer(readRows); }
/** * Returns how many rows we fetched with nextBuffer(). It only means how many rows * are read by nextBuffer(). The returned result may be smaller than actual number * of rows passed by, because {@link #seek(long)} can change the underlying key buffer and * value buffer. * * @return next row number * @throws java.io.IOException */ public boolean nextBuffer(LongWritable readRows) throws IOException { if (readRowsIndexInBuffer < recordsNumInValBuffer) { readRows.set(passedRowsNum); readRowsIndexInBuffer++; passedRowsNum++; rowFetched = false; return true; } else { keyInit = false; } int ret = -1; try { ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace(); } return (ret > 0) && nextBuffer(readRows); }
/** * Returns how many rows we fetched with nextBuffer(). It only means how many rows * are read by nextBuffer(). The returned result may be smaller than actual number * of rows passed by, because {@link #seek(long)} can change the underlying key buffer and * value buffer. * * @return next row number * @throws java.io.IOException */ public boolean nextBuffer(LongWritable readRows) throws IOException { if (readRowsIndexInBuffer < recordsNumInValBuffer) { readRows.set(passedRowsNum); readRowsIndexInBuffer++; passedRowsNum++; rowFetched = false; return true; } else { keyInit = false; } int ret = -1; try { ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace(); } return (ret > 0) && nextBuffer(readRows); }
ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace();
ret = nextKeyBuffer(); } catch (EOFException eof) { eof.printStackTrace();