id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
2,000 | 20,955,452 | 3,932,179 | private void criarQuestaoMultiplaEscolha(QuestaoMultiplaEscolha q) throws SQLException {
PreparedStatement stmt = null;
String sql = "INSERT INTO multipla_escolha (id_questao, texto, gabarito) VALUES (?,?,?)";
try {
for (Alternativa alternativa : q.getAlternativa()) {
... | static String getMD5Sum(String source) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(source.getBytes());
byte[] md5sum = digest.digest();
BigInteger bigInt = new BigInteger(1, md5sum);
return bigInt.toString(16);
... | false |
2,001 | 9,687,064 | 98,309 | public static synchronized int registerVote(String IDVotazione, byte[] T1, byte[] sbT2, byte[] envelope, Config config) {
if (IDVotazione == null) {
LOGGER.error("registerVote::IDV null");
return C_addVote_BOH;
}
if (T1 == null) {
LOGGER.error("registerVot... | public void readMESHDescriptorFileIntoFiles(String outfiledir) {
String inputLine, ins;
String filename = getMESHdescriptorfilename();
String uid = "";
String name = "";
String description = "";
String element_of = "";
Vector treenr = new Vector();
Vec... | false |
2,002 | 11,066,056 | 22,821,011 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public static void main(String[] args) {
String command = "java -jar ";
String linkerJarPath = "";
String path = "";
String osName = System.getProperty("os.name");
String temp = Launcher.class.getResource("").toString();
int index = temp.indexOf(".jar");
int ... | true |
2,003 | 17,545,948 | 13,862,568 | public void run() {
try {
URL url = new URL("http://pokedev.org/time.php");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringTokenizer s = new StringTokenizer(in.readLine());
m_day = Integer.parseInt(s.nextToken());
... | private String getShaderIncludeSource(String path) throws Exception {
URL url = this.getClass().getResource(path);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
boolean run = true;
String str;
String ret = new String();
while (run) {... | true |
2,004 | 380,318 | 8,562,659 | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | protected void validate(long googcmId, long reservePrice, String description, String category, int days, String status, String title, byte[] imgBytes) throws PortalException, SystemException {
if (Validator.isNull(description)) throw new AuctionDescriptionException(); else if (Validator.isNull(title)) throw... | false |
2,005 | 23,370,620 | 4,260,650 | private File prepareFileForUpload(File source, String s3key) throws IOException {
File tmp = File.createTempFile("dirsync", ".tmp");
tmp.deleteOnExit();
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(source);
out = new D... | public void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
Closer c = new Closer();
try {
source = c.register(new Fi... | true |
2,006 | 16,410,666 | 20,601,754 | public void backup(File source) throws BackupException {
try {
int index = source.getAbsolutePath().lastIndexOf(".");
if (index == -1) return;
File dest = new File(source.getAbsolutePath().substring(0, index) + ".bak");
FileChannel srcChannel = new FileInputSt... | public static File copyFile(File file, String dirName) {
File destDir = new File(dirName);
if (!destDir.exists() || !destDir.isDirectory()) {
destDir.mkdirs();
}
File src = file;
File dest = new File(dirName, src.getName());
try {
if (!dest.exi... | true |
2,007 | 12,816,475 | 11,339,042 | protected void writePage(final CacheItem entry, final TranslationResponse response, ModifyTimes times) throws IOException {
if (entry == null) {
return;
}
Set<ResponseHeader> headers = new TreeSet<ResponseHeader>();
for (ResponseHeader h : entry.getHeaders()) {
... | public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = null;
ServletOutputStream outstream = null;
try {
String action = req.getParameter("nmrshiftdbaction");
String relativepath = ServletUtils.expa... | true |
2,008 | 15,115,748 | 8,939,074 | public void render(final HttpServletRequest request, final HttpServletResponse response, InputStream inputStream, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding... | public RawTableData(int selectedId) {
selectedProjectId = selectedId;
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetProjectDocuments";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "documents.xml";
try {
S... | true |
2,009 | 21,364,786 | 7,384,218 | public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException {
boolean bMatch = false;
try {
String strSalt = (String) salt;
byte[] baSalt = Hex.decodeHex(strSalt.toCharArray());
MessageDigest md = MessageDigest.getInstanc... | public void run() {
counter = 0;
Log.debug("Fetching news");
Session session = botService.getSession();
if (session == null) {
Log.warn("No current IRC session");
return;
}
final List<Channel> channels = session.getChannels();
if (chann... | true |
2,010 | 694,747 | 9,996,802 | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | public static int copy(File src, int amount, File dst) {
final int BUFFER_SIZE = 1024;
int amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputStre... | true |
2,011 | 19,035,955 | 861,011 | public static void main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\testTDESENC.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESDEC.txt"));
Sin... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
2,012 | 20,068,373 | 16,850,376 | @Override
public DataUpdateResult<Record> archiveRecord(String authToken, Record record, Filter filter, Field sourceField, InputModel inputmodel) throws DataOperationException {
validateUserIsSignedOn(authToken);
validateUserHasAdminRights(authToken);
DataUpdateResult<Record> recordUpdat... | public static void uncompress(File srcFile, File destFile) throws IOException {
InputStream input = null;
OutputStream output = null;
try {
input = new GZIPInputStream(new FileInputStream(srcFile));
output = new BufferedOutputStream(new FileOutputStream(destFile));
... | false |
2,013 | 20,080,077 | 17,826,787 | public Writer createWriter(File outfile, String encoding) throws UnsupportedEncodingException, IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outfile));
zos.setMethod(ZipO... | public void updateDb(int scriptNumber) throws SQLException, IOException {
String pathName = updatesPackage.replace(".", "/");
InputStream in = getClass().getClassLoader().getResourceAsStream(pathName + "/" + scriptNumber + ".sql");
ByteArrayOutputStream out = new ByteArrayOutputStream();
... | true |
2,014 | 15,007,015 | 22,534,224 | public static byte[] wrapBMP(Image image) throws IOException {
if (image.getOriginalType() != Image.ORIGINAL_BMP) throw new IOException("Only BMP can be wrapped in WMF.");
InputStream imgIn;
byte data[] = null;
if (image.getOriginalData() == null) {
imgIn = image.url().op... | public void openUrlActionPerformed(ActionEvent event) {
RemoteFileChooser fileChooser = new RemoteFileChooser(this, getAppName());
fileChooser.getDialog().setVisible(true);
if (fileChooser.getResult() == JOptionPane.OK_OPTION) {
setCursorBusy(true);
URL url = fileChoo... | false |
2,015 | 2,858,807 | 7,449,124 | public void actionPerformed(ActionEvent ae) {
Window win = SwingUtilities.getWindowAncestor(invokerInfo.getComponent());
if (ae.getActionCommand().equals(LOAD)) {
URLChooser uc;
if (win instanceof Frame) {
uc = new URLChooser((Frame) wi... | private long getRecordedSessionLength() {
long lRet = -1;
String strLength = this.applet.getParameter(Constants.PLAYBACK_MEETING_LENGTH_PARAM);
if (null != strLength) {
lRet = (new Long(strLength)).longValue();
} else {
Properties recProps = new Properties();
... | false |
2,016 | 8,665,323 | 19,861,528 | public String GetMemberName(String id) {
String name = null;
try {
String line;
URL url = new URL(intvasmemberDeatails + "?CID=" + id);
URLConnection connection = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(co... | public static void getGroupsImage(String username) {
try {
URL url = new URL("http://www.lastfm.de/user/" + username + "/groups/");
URLConnection con = url.openConnection();
HashMap hm = new HashMap();
Parser parser = new Parser(con);
NodeList imag... | false |
2,017 | 12,415,477 | 2,285,441 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String limitsSet = "";
String synstatus = SystemFilesLoader.getInstance().getNewgenlibProperties().getProperty("SYNDETICS", "OFF");
String synncod... | static synchronized Person lookup(PhoneNumber number, String siteName) {
Vector<Person> foundPersons = new Vector<Person>(5);
if (number.isFreeCall()) {
Person p = new Person("", "FreeCall");
p.addNumber(number);
foundPersons.add(p);
} else if (number.isSI... | false |
2,018 | 5,198,625 | 20,596,006 | public static Pedido insert(Pedido objPedido) {
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
int result;
if (c == null) {
return null;
}
try {
c.setAutoCommit(false);
String sql = "";
... | public APIResponse update(Item item) throws Exception {
APIResponse response = new APIResponse();
connection = (HttpURLConnection) new URL(url + "/api/item/update").openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setRequestProper... | false |
2,019 | 11,982,462 | 14,915,965 | private Document getXMLDoc(Region region) {
Document doc;
try {
InputStream stream;
URL url = new URL("http://eve-central.com/api/marketstat?hours=" + HOURS + "&" + getTypes() + "®ionlimit=" + region.getTypeID());
System.out.println(url.toString());
... | protected static String getInitialUUID() {
if (myRand == null) {
myRand = new Random();
}
long rand = myRand.nextLong();
String sid;
try {
sid = InetAddress.getLocalHost().toString();
} catch (UnknownHostException e) {
sid = Thread.... | false |
2,020 | 5,414,796 | 21,172,450 | public static void upper() throws Exception {
File input = new File("dateiname");
PostMethod post = new PostMethod("url");
post.setRequestBody(new FileInputStream(input));
if (input.length() < Integer.MAX_VALUE) post.setRequestContentLength((int) input.length()); else post.setRequest... | public static void unzip2(String strZipFile, String folder) throws IOException, ArchiveException {
FileUtil.fileExists(strZipFile, true);
final InputStream is = new FileInputStream(strZipFile);
ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
Zi... | false |
2,021 | 432,090 | 16,981,231 | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | public static boolean verify(final String password, final String encryptedPassword) {
MessageDigest digest = null;
int size = 0;
String base64 = null;
if (encryptedPassword.regionMatches(true, 0, "{CRYPT}", 0, 7)) {
throw new InternalError("Not implemented");
} el... | false |
2,022 | 694,747 | 17,267,680 | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | private String transferWSDL(String wsdlURL, String userPassword) throws WiseConnectionException {
String filePath = null;
try {
URL endpoint = new URL(wsdlURL);
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setDoOutput(false);
... | true |
2,023 | 8,693,826 | 23,482,443 | private String readJsonString() {
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(SERVER_URL);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getSt... | public static String getDocumentAsString(URL url) throws IOException {
StringBuffer result = new StringBuffer();
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF8"));
String line = "";
while (line != null) {
result.append(line);
... | true |
2,024 | 19,994,918 | 4,484,215 | void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
out.close... | @Override
public void dispatchContent(InputStream is) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Sending content message over JMS");
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(is, bos);
this.send(new MessageC... | true |
2,025 | 5,157,858 | 15,637,504 | private void simulate() throws Exception {
BufferedWriter out = null;
out = new BufferedWriter(new FileWriter(outFile));
out.write("#Thread\tReputation\tAction\n");
out.flush();
System.out.println("Simulate...");
File file = new File(trsDemoSimulationfile);
Ob... | @Override
protected void setUp() throws Exception {
this.logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
File repoFolder = new File("target/repository");
removeRepository(repoFolder);
InputStream repoConfigIn = getClass().getResourceAsStream(REPO_CONFIG_FILE);
File ... | true |
2,026 | 9,104,988 | 4,591,684 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | public static void copyDirs(File sourceDir, File destDir) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (File file : sourceDir.listFiles()) {
if (file.isDirectory()) {
copyDirs(file, new File(destDir, file.getName()));
} else {
... | false |
2,027 | 3,058,818 | 6,992,704 | public static void encryptFile(String input, String output, String pwd) throws Exception {
CipherOutputStream out;
InputStream in;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(pwd.getBytes(), "DES... | public static void main(String[] args) {
File file = null;
try {
file = File.createTempFile("TestFileChannel", ".dat");
final ByteBuffer buffer = ByteBuffer.allocateDirect(4);
final ByteChannel output = new FileOutputStream(file).getChannel();
buffer.p... | true |
2,028 | 13,068,082 | 5,430,189 | public JobOfferPage(JobPageLink link) {
this.link = link;
try {
URL url = new URL(link.getUrl());
URLConnection urlConn = url.openConnection();
urlConn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)");
urlConn.setR... | public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
... | false |
2,029 | 9,685,053 | 3,726,610 | public Result request(URL url) {
try {
return xmlUtil.unmarshall(urlOpener.openStream(url));
} catch (FileNotFoundException e) {
log.info("File not found: " + url);
} catch (IOException e) {
log.error("Failed to read from url: " + url + ". " + e.getMessage... | private static void processFile(StreamDriver driver, String sourceName) throws Exception {
String destName = sourceName + ".xml";
File dest = new File(destName);
if (dest.exists()) {
throw new IllegalArgumentException("File '" + destName + "' already exists!");
}
... | false |
2,030 | 23,658,098 | 506,382 | public void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.c... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | false |
2,031 | 7,542,014 | 19,467,546 | public static String[] parsePLS(String strURL, Context c) {
URL url;
URLConnection urlConn = null;
String TAG = "parsePLS";
Vector<String> radio = new Vector<String>();
final String filetoken = "file";
final String SPLITTER = "=";
try {
url = new U... | @Override
public boolean saveCart(Carrito cart, boolean completado, String date, String formPago) {
Connection conexion = null;
PreparedStatement insertHistorial = null;
PreparedStatement insertCarrito = null;
boolean exito = false;
try {
conexion = pool.getCo... | false |
2,032 | 11,149,084 | 21,925,741 | private void deleteProject(String uid, String home, HttpServletRequest request, HttpServletResponse response) throws Exception {
String project = request.getParameter("project");
String line;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
htmlHe... | public static boolean predictDataSet(String completePath, String Type, String predictionOutputFileName, String slopeOneDataFolderName) {
try {
if (Type.equalsIgnoreCase("Qualifying")) {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + "CompleteQualifyingDataI... | true |
2,033 | 250,595 | 18,976,771 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void compressImage(InputStream input, OutputStream output, DjatokaEncodeParam params) throws DjatokaException {
if (params == null) params = new DjatokaEncodeParam();
File inputFile = null;
try {
inputFile = File.createTempFile("tmp", ".tif");
IOUtils.copyStrea... | true |
2,034 | 1,638,505 | 6,883,227 | private Vendor createVendor() throws SQLException, IOException {
Connection conn = null;
Statement st = null;
String query = null;
ResultSet rs = null;
try {
conn = dataSource.getConnection();
st = conn.createStatement();
query = "insert in... | private HttpURLConnection getConnection(String url) throws IOException {
HttpURLConnection con = null;
if (proxyHost != null && !proxyHost.equals("")) {
if (proxyAuthUser != null && !proxyAuthUser.equals("")) {
log("Proxy AuthUser: " + proxyAuthUser);
log(... | false |
2,035 | 18,456,843 | 5,665,159 | public String storeUploadedZip(byte[] zip, String name) {
List filesToStore = new ArrayList();
int i = 0;
ZipInputStream zipIs = new ZipInputStream(new ByteArrayInputStream(zip));
ZipEntry zipEntry = zipIs.getNextEntry();
while (zipEntry != null) {
if (zipEntry.is... | private String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
System... | false |
2,036 | 557,734 | 15,593,678 | public void constructAssociationView() {
String className;
String methodName;
String field;
boolean foundRead = false;
boolean foundWrite = false;
boolean classWritten = false;
try {
AssocView = new BufferedWriter(new FileWriter("InfoFiles/Associat... | private static void copyFile(File in, File out) throws Exception {
final FileInputStream input = new FileInputStream(in);
try {
final FileOutputStream output = new FileOutputStream(out);
try {
final byte[] buf = new byte[4096];
int readBytes = ... | true |
2,037 | 11,312,022 | 19,321,031 | public static void downloadFromUrl(URL url, String localFilename, String userAgent) throws IOException {
InputStream is = null;
FileOutputStream fos = null;
System.setProperty("java.net.useSystemProxies", "true");
try {
URLConnection urlConn = url.openConnection();
... | public static ArrayList<String> remoteCall(Map<String, String> dataDict) {
ArrayList<String> result = new ArrayList<String>();
String encodedData = "";
for (String key : dataDict.keySet()) {
String encodedSegment = "";
String value = dataDict.get(key);
if ... | false |
2,038 | 7,757,210 | 14,650,348 | @RequestMapping("/download")
public void download(HttpServletRequest request, HttpServletResponse response) {
InputStream input = null;
ServletOutputStream output = null;
try {
String savePath = request.getSession().getServletContext().getRealPath("/upload");
Stri... | public static ArrayList<FriendInfo> downloadFriendsList(String username) {
try {
URL url;
url = new URL(WS_URL + "/user/" + URLEncoder.encode(username, "UTF-8") + "/friends.xml");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect(... | false |
2,039 | 2,177,544 | 2,883,828 | public static boolean makeBackup(File dir, String sourcedir, String destinationdir, String destinationDirEnding, boolean autoInitialized) {
boolean success = false;
String[] files;
files = dir.list();
File checkdir = new File(destinationdir + System.getProperty("file.separator") + de... | public static void copyFile(File from, File to) {
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
byte[] buffer = new byte[1024 * 16];
int read = 0;
while ((read = i... | true |
2,040 | 14,341,903 | 16,879,559 | private static void processFile(String file) throws IOException {
FileInputStream in = new FileInputStream(file);
int read = 0;
byte[] buf = new byte[2048];
ByteArrayOutputStream bout = new ByteArrayOutputStream();
while ((read = in.read(buf)) > 0) bout.write(buf, 0, read);
... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText eText = (EditText) findViewById(R.id.address);
final Button button = (Button) findViewById(R.id.ButtonGo);
button.setOnClickListen... | false |
2,041 | 18,773,070 | 16,865,047 | public static void main(String[] args) {
if (args.length != 2) throw new IllegalArgumentException();
String inFileName = args[0];
String outFileName = args[1];
File fInput = new File(inFileName);
Scanner in = null;
try {
in = new Scanner(fInput);
}... | public void serviceDocument(final TranslationRequest request, final TranslationResponse response, final Document document) throws Exception {
response.addHeaders(document.getResponseHeaders());
try {
IOUtils.copy(document.getInputStream(), response.getOutputStream());
respons... | true |
2,042 | 430,971 | 14,661,394 | public static void copyFile(File destFile, File src) throws IOException {
File destDir = destFile.getParentFile();
File tempFile = new File(destFile + "_tmp");
destDir.mkdirs();
InputStream is = new FileInputStream(src);
try {
FileOutputStream os = new FileOutputS... | public void run() {
XmlFilesFilter filter = new XmlFilesFilter();
String pathTemp = Settings.get("vo_store.databaseMetaCollection");
String sectionName = pathTemp.substring(1, pathTemp.indexOf("/", 2));
String templateName = VOAccess.getElementByName(settingsDB, "TEMPLATE", sectionNa... | true |
2,043 | 17,325,960 | 21,946,945 | private String getMD5(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] data = md.digest();
return convertToHex(data);
} catch (Exception ex) {
ex.printStackTrace();
... | public static String SHA1(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
... | true |
2,044 | 3,357,695 | 18,942,519 | public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException, CatalogException {
URL url = null;
try {
url = new URL(fileUrl);
} catch (MalformedURLException e) {
url = new URL("file:///" + fileUrl);
}
debug = cata... | public void deleteRole(AuthSession authSession, RoleBean roleBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (roleBean.getRoleId() == null) throw new IllegalArgumentException("role id is null");
... | false |
2,045 | 1,699,618 | 17,456,566 | public static void copyURLToFile(URL source, File destination) throws IOException {
if (destination.getParentFile() != null && !destination.getParentFile().exists()) {
destination.getParentFile().mkdirs();
}
if (destination.exists() && !destination.canWrite()) {
Strin... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
2,046 | 5,318,443 | 5,832,949 | public void init(IWorkbench workbench) {
preferences.setFilename(CorePlugin.getDefault().getStateLocation().append("log4j.properties").toOSString());
registry = Platform.getExtensionRegistry();
extensionPoint = registry.getExtensionPoint(CorePlugin.LOGGER_PREFERENCES_EXTENSION_POINT);
... | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
WebResponse response = wc.getResponse(req)... | false |
2,047 | 2,217,508 | 17,067,833 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | private void copyResourceToDir(String ondexDir, String resource) {
InputStream inputStream = OndexGraphImpl.class.getClassLoader().getResourceAsStream(resource);
try {
FileWriter fileWriter = new FileWriter(new File(ondexDir, resource));
IOUtils.copy(inputStream, fileWriter);... | true |
2,048 | 12,524,253 | 22,177,057 | public DialogSongList(JFrame frame) {
super(frame, "Menu_SongList", "songList");
setMinimumSize(new Dimension(400, 200));
JPanel panel, spanel;
Container contentPane;
(contentPane = getContentPane()).add(songSelector = new SongSelector(configKey, null, true));
songSel... | private void saveFile(File destination) {
InputStream in = null;
OutputStream out = null;
try {
if (fileScheme) in = new BufferedInputStream(new FileInputStream(source.getPath())); else in = new BufferedInputStream(getContentResolver().openInputStream(source));
out = ... | true |
2,049 | 19,180,786 | 23,247,146 | public void testCopyFolderContents() throws IOException {
log.info("Running: testCopyFolderContents()");
IOUtils.copyFolderContents(srcFolderName, destFolderName);
Assert.assertTrue(destFile1.exists() && destFile1.isFile());
Assert.assertTrue(destFile2.exists() && destFile2.isFile())... | @Override
public synchronized HttpURLConnection getTileUrlConnection(int zoom, int tilex, int tiley) throws IOException {
HttpURLConnection conn = null;
try {
String url = getTileUrl(zoom, tilex, tiley);
conn = (HttpURLConnection) new URL(url).openConnection();
} ... | false |
2,050 | 9,236,362 | 1,699,618 | private String unJar(String jarPath, String jarEntry) {
String path;
if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/"));
String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/"));
... | public static void copyURLToFile(URL source, File destination) throws IOException {
if (destination.getParentFile() != null && !destination.getParentFile().exists()) {
destination.getParentFile().mkdirs();
}
if (destination.exists() && !destination.canWrite()) {
Strin... | true |
2,051 | 7,062,953 | 1,899,629 | public JarClassLoader(ClassLoader parent) {
super(parent);
initLogger();
hmClass = new HashMap<String, Class<?>>();
lstJarFile = new ArrayList<JarFileInfo>();
hsDeleteOnExit = new HashSet<File>();
String sUrlTopJar = null;
pd = getClass().getProtectionDomain()... | private String getMD5Password(String plainText) throws NoSuchAlgorithmException {
MessageDigest mdAlgorithm;
StringBuffer hexString = new StringBuffer();
String md5Password = "";
mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(plainText.getBytes());
... | false |
2,052 | 14,416,222 | 21,161,120 | private boolean subtitleDownload(Movie movie, File movieFile, File subtitleFile) {
try {
String ret;
String xml;
String moviehash = getHash(movieFile);
String moviebytesize = String.valueOf(movieFile.length());
xml = generateXMLRPCSS(moviehash, mov... | public static void main(String[] args) {
String host;
int port;
char[] passphrase;
System.out.println("InstallCert - Install CA certificate to Java Keystore");
System.out.println("=====================================================");
final BufferedReader reader = n... | false |
2,053 | 4,519,500 | 308,643 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String pathInfo = req.getPathInfo();
String pluginPathInfo = pathInfo.substring(prefix.length());
String gwtPathInfo = pluginPathInfo.substring(pluginKey.length() + 1);... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
2,054 | 7,680,527 | 14,430,650 | static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = m... | private String computeHash(String str) {
StringBuffer hexBuffer = new StringBuffer();
byte[] bytes;
int i;
try {
MessageDigest hashAlgorithm = MessageDigest.getInstance(hashAlgorithmName);
hashAlgorithm.reset();
hashAlgorithm.update(str.getBytes())... | true |
2,055 | 8,637,246 | 2,825,450 | @Override
public void setDocumentSpace(DocumentSpace space) {
for (Document doc : space) {
File result = new File(parent, doc.getName());
if (doc instanceof XMLDOMDocument) {
new PlainXMLDocumentWriter(result).writeDocument(doc);
} else if (doc instanc... | public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | true |
2,056 | 23,658,098 | 8,041,989 | public void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.c... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
String requestURI = req.getRequestURI();
logger.info("The requested URI: {}", requestURI);
String parameter = requestURI.substring(requestURI.lastIndexOf(ARXIVID_ENTRY) + ARXIVID_EN... | true |
2,057 | 1,123,203 | 23,299,439 | public TextureData newTextureData(GLProfile glp, URL url, int internalFormat, int pixelFormat, boolean mipmap, String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
return newTextureData(glp, stream, internalFormat, ... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String contentType = req.getParameter("type");
String arg = req.getParameter("file");
if (arg == null) {
resp.sendError(404, "Missing File Arg");
... | false |
2,058 | 6,068,118 | 11,339,042 | public byte[] exportCommunityData(String communityId) throws RepositoryException, IOException {
Community community;
try {
community = getCommunityById(communityId);
} catch (CommunityNotFoundException e1) {
throw new GroupwareRuntimeException("Community to export not... | public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = null;
ServletOutputStream outstream = null;
try {
String action = req.getParameter("nmrshiftdbaction");
String relativepath = ServletUtils.expa... | true |
2,059 | 3,287,281 | 7,259,526 | private void googleImageSearch() {
bottomShowing = true;
googleSearched = true;
googleImageLocation = 0;
googleImages = new Vector<String>();
custom = "";
int r = JOptionPane.showConfirmDialog(this, "Customize google search?", "Google Search", JOptionPane.YES_NO_OPTIO... | public void SetRoles(Connection conn, User user, String[] roles) throws NpsException {
if (!IsSysAdmin() && !IsLocalAdmin()) throw new NpsException(ErrorHelper.ACCESS_NOPRIVILEGE);
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
String sql = "delete from userro... | false |
2,060 | 21,496,578 | 2,232,619 | public Object construct() {
String fullName = lRegatta.getSaveDirectory() + lRegatta.getSaveName();
System.out.println(MessageFormat.format(res.getString("MainMessageBackingUp"), new Object[] { fullName + BAK }));
try {
FileInputStream fis ... | public void testStorageStringWriter() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
Writer w = r.getWriter();
w.write("This is an example");
w.write(" and another one.");
w.flush();
ass... | true |
2,061 | 18,623,183 | 4,542,694 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | @Override
public InputStream getInputStream() throws IOException {
if (dfos == null) {
int deferredOutputStreamThreshold = Config.getInstance().getDeferredOutputStreamThreshold();
dfos = new DeferredFileOutputStream(deferredOutputStreamThreshold, Definitions.PROJECT_NAME, "." + D... | true |
2,062 | 13,287,093 | 22,537,277 | private boolean load(URL url) {
try {
URLConnection connection = url.openConnection();
parser = new PDFParser(connection.getInputStream());
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
| @Test
public void testSQLite() {
log("trying SQLite..");
for (int i = 0; i < 10; i++) {
Connection c = null;
try {
Class.forName("SQLite.JDBCDriver");
c = DriverManager.getConnection("jdbc:sqlite:/C:/Source/SRFSurvey/app/src/org/speakright/... | false |
2,063 | 9,492,898 | 8,181,035 | public static Object getInputStream(String name, boolean showMsg, URL appletDocumentBase, String appletProxy) {
String errorMessage = null;
int iurlPrefix;
for (iurlPrefix = urlPrefixes.length; --iurlPrefix >= 0; ) if (name.startsWith(urlPrefixes[iurlPrefix])) break;
boolean isURL = ... | private String getData(String method, String arg) {
try {
URL url;
String str;
StringBuilder strBuilder;
BufferedReader stream;
url = new URL(API_BASE_URL + "/2.1/" + method + "/en/xml/" + API_KEY + "/" + URLEncoder.encode(arg, "UTF-8"));
... | false |
2,064 | 6,948,655 | 17,119,760 | public static void main(String[] args) throws IOException {
File fileIn = new File("D:\\zz_c\\study2\\src\\study\\io\\A.java");
InputStream fin = new FileInputStream(fileIn);
PipedInputStream pin = new PipedInputStream();
PipedOutputStream pout = new PipedOutputStream();
pout... | public void testReaderWriterF2() throws Exception {
String inFile = "test_data/mri.png";
String outFile = "test_output/mri__smooth_testReaderWriter.mhd";
itkImageFileReaderF2_Pointer reader = itkImageFileReaderF2.itkImageFileReaderF2_New();
itkImageFileWriterF2_Pointer writer = itkIm... | true |
2,065 | 3,197,089 | 16,832,679 | public void insertStringInFile(String file, String textToInsert, long fromByte, long toByte) throws Exception {
String tmpFile = file + ".tmp";
BufferedInputStream in = null;
BufferedOutputStream out = null;
long byteCount = 0;
try {
in = new BufferedInputStream(n... | public byte[] getXQueryForWorkflow(String workflowURI, Log4JLogger log) throws MalformedURLException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
if (workflowURI == null) {
throw new XQGeneratorException("Null workflow URI");
}
URL url = ... | false |
2,066 | 16,328,840 | 7,998,444 | protected InputStream transform(URL url) throws IOException {
TransformerFactory tf = TransformerFactory.newInstance();
InputStream xsl_is = null;
InputStream url_is = null;
ByteArrayOutputStream os = null;
byte[] output;
try {
xsl_is = Classes.getThreadCl... | public static boolean isDicom(URL url) {
assert url != null;
boolean isDicom = false;
BufferedInputStream is = null;
try {
is = new BufferedInputStream(url.openStream());
is.skip(DICOM_PREAMBLE_SIZE);
byte[] buf = new byte[DICM.length];
... | false |
2,067 | 10,178,421 | 14,072,818 | @Override
public void run() {
File file;
try {
file = new File(filePath);
if (!file.canWrite()) {
Thread.sleep(5000);
if (!file.canWrite()) {
logger.error("Filed to gain write access to file:" + filePath);
... | public osid.shared.Id ingest(String fileName, String templateFileName, String fileType, File file, Properties properties) throws osid.dr.DigitalRepositoryException, java.net.SocketException, java.io.IOException, osid.shared.SharedException, javax.xml.rpc.ServiceException {
long sTime = System.currentTimeMil... | true |
2,068 | 13,657,107 | 7,395,775 | public void add(final String name, final String content) {
forBundle(new BundleManipulator() {
public boolean includeEntry(String entryName) {
return !name.equals(entryName);
}
public void finish(Bundle bundle, ZipOutputStream zout) throws IOException {
... | private void copyReportFile(ServletRequest req, String reportName, Report report) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, FileNotFoundException, IOException {
String reportFileName = (String) Class.forName("org.eclipse.birt.report.utility.Para... | true |
2,069 | 7,726,775 | 10,118,207 | public void write(URL exportUrl, OutputStream output) throws Exception {
if (exportUrl == null || output == null) {
throw new DocumentListException("null passed in for required parameters");
}
MediaContent mc = new MediaContent();
mc.setUri(exportUrl.toString());
... | public static final boolean zipUpdate(String zipfile, String name, String oldname, byte[] contents, boolean delete) {
try {
File temp = File.createTempFile("atf", ".zip");
InputStream in = new BufferedInputStream(new FileInputStream(zipfile));
OutputStream os = new Buffer... | true |
2,070 | 9,186,582 | 2,967,952 | private static void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
if (!outputFile.g... | private void showAboutBox() {
String message = new String("Error: Resource Not Found.");
java.net.URL url = ClassLoader.getSystemResource("docs/about.html");
if (url != null) {
try {
StringBuffer buf = new StringBuffer();
BufferedReader reader = ne... | false |
2,071 | 20,508,693 | 10,816,494 | private void zip(FileHolder fileHolder, int zipCompressionLevel) {
byte[] buffer = new byte[BUFFER_SIZE];
int bytes_read;
if (fileHolder.selectedFileList.size() == 0) {
return;
}
File zipDestFile = new File(fileHolder.destFiles[0]);
try {
ZipOu... | @Override
public void sendData(String serverUrl, String fileName, String type, InputStream is) throws IOException {
ClientSession clientSession = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + serverUrl);
}
clientSes... | true |
2,072 | 18,628,318 | 7,545,001 | public static String generateDigest(String message, String DigestAlgorithm) {
try {
MessageDigest md = MessageDigest.getInstance(DigestAlgorithm);
md.update(message.getBytes(), 0, message.length());
return new BigInteger(1, md.digest()).toString(16);
} catch (NoSu... | public static Object GET(String url, String[][] props) throws IOException {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("GET");
for (int i = 0; i < props.length; ++i) {
conn.addRequestProperty(props[i][0], URLEncoder.encode(pr... | false |
2,073 | 17,468,430 | 7,276,772 | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | public void testBlobB() {
ResultSet rs;
byte[] ba;
byte[] baR1 = new byte[] { (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, (byte) 0xF6, (byte) 0xF7, (byte) 0xF8, (byte) 0xF9, (byte) 0xFA, (byte) 0xFB };
byte[] baR2 = new byte[] { (byte) 0xE1, (byte) 0xE2, (byte) 0... | false |
2,074 | 7,468,829 | 20,331,164 | public static String doGetWithBasicAuthentication(URL url, String username, String password, int timeout, Map<String, String> headers) throws Throwable {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setDoInput(true);
if (username ... | public int read(String name) {
status = STATUS_OK;
try {
name = name.trim().toLowerCase();
if ((name.indexOf("file:") >= 0) || (name.indexOf(":/") > 0)) {
URL url = new URL(name);
in = new BufferedInputStream(url.openStream());
} el... | false |
2,075 | 7,512,156 | 6,031,248 | @Override
public void execute(String[] args) throws Exception {
Options cmdLineOptions = getCommandOptions();
try {
GnuParser parser = new GnuParser();
CommandLine commandLine = parser.parse(cmdLineOptions, TolvenPlugin.getInitArgs());
String srcRepositoryURLS... | public static void copyFile(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf ... | true |
2,076 | 14,959,920 | 7,149,321 | public void run() {
try {
exists_ = true;
URL url = getContentURL();
URLConnection cnx = url.openConnection();
cnx.connect();
lastModified_ = cnx.getLastModified();... | public static Dimension getJPEGDimension(String urls) throws IOException {
URL url;
Dimension d = null;
try {
url = new URL(urls);
InputStream fis = url.openStream();
if (fis.read() != 255 || fis.read() != 216) throw new RuntimeException("SOI (Start Of Ima... | false |
2,077 | 20,412,493 | 16,353,456 | void readData(URL url) throws IOException {
int i = 0, j = 0, k = 0;
double xvalue, yvalue;
double xindex, yindex;
InputStream is = url.openStream();
is.mark(0);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
... | private void fileCopy(File filename) throws IOException {
if (this.stdOut) {
this.fileDump(filename);
return;
}
File source_file = new File(spoolPath + "/" + filename);
File destination_file = new File(copyPath + "/" + filename);
FileInputStream source... | false |
2,078 | 15,489,464 | 15,328,073 | public Object send(URL url, Object params) throws Exception {
params = processRequest(params);
String response = "";
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
response += in.readLine();
while (response != null) response += in.readLine();... | public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | false |
2,079 | 9,730,236 | 3,224,152 | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
... | private String transferWSDL(String usernameAndPassword) throws WiseConnectionException {
String filePath = null;
try {
URL endpoint = new URL(wsdlURL);
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setDoOutput(false);
con... | true |
2,080 | 679,959 | 9,339,937 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public FileReader(String filePath, Configuration aConfiguration) throws IOException {
file = new File(URLDecoder.decode(filePath, "UTF-8")).getCanonicalFile();
readerConf = aConfiguration;
if (file.isDirectory()) {
File indexFile = new File(file, "index.php");
File in... | true |
2,081 | 8,403,573 | 3,318,214 | public static void copyFile(File src, String srcEncoding, File dest, String destEncoding) throws IOException {
InputStreamReader in = new InputStreamReader(new FileInputStream(src), srcEncoding);
OutputStreamWriter out = new OutputStreamWriter(new RobustFileOutputStream(dest), destEncoding);
... | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | true |
2,082 | 5,808,067 | 18,464,490 | @Override
public void action(String msg, String uri, Gateway gateway) throws Exception {
String city = "成都";
if (msg.indexOf("#") != -1) {
city = msg.substring(msg.indexOf("#") + 1);
}
String url = "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx/getWeather... | @Override
public void actionPerformed(ActionEvent e) {
if (copiedFiles_ != null) {
File[] tmpFiles = new File[copiedFiles_.length];
File tmpDir = new File(Settings.getPropertyString(ConstantKeys.project_dir), "tmp/");
tmpDir.mkdirs();
... | false |
2,083 | 945,607 | 11,986,970 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void Copy() throws IOException {
if (!FileDestination.exists()) {
FileDestination.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(FileSource).getChannel();
destination ... | true |
2,084 | 18,796,914 | 9,217 | public String getPloidy(String source) {
StringBuilder ploidyHtml = new StringBuilder();
String hyperdiploidyUrl = customParameters.getHyperdiploidyUrl();
String urlString = hyperdiploidyUrl + "?source=" + source;
URL url = null;
try {
url = new URL(urlString);
... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
2,085 | 948,487 | 17,999,460 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static long toFile(final DigitalObject object, final File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
long bytesCopied = IOUtils.copyLarge(object.getContent().getInputStream(), fOut);
fOut.close();
return bytesCopied;
} cat... | true |
2,086 | 5,520,449 | 21,119,989 | protected void init() {
if (this.strUrl != null) {
InputStream in = null;
try {
URL url = ClassLoader.getSystemClassLoader().getResource(strUrl);
if (url != null) {
in = url.openStream();
if (in != null) {
... | public static final InputStream openStream(Bundle bundle, IPath file, boolean localized) throws IOException {
URL url = null;
if (!localized) {
url = findInPlugin(bundle, file);
if (url == null) url = findInFragments(bundle, file);
} else {
url = FindSuppo... | false |
2,087 | 21,201,276 | 19,752,872 | private static void run(Display display, int x) {
Shell shell = new Shell(display);
shell.setBounds(0, 0, 350, 350);
shell.setLayout(new FillLayout(SWT.VERTICAL));
ERDiagramEditPartFactory editPartFactory = new ERDiagramEditPartFactory();
GraphicalViewer viewer = new Scrollin... | public void searchEntity(HttpServletRequest req, HttpServletResponse resp, SearchCommand command) {
setHeader(resp);
logger.debug("Search: Looking for the entity with the id:" + command.getSearchedid());
String login = command.getLogin();
String password = command.getPassword();
... | false |
2,088 | 1,214,974 | 10,798,829 | public static String computeMD5(InputStream input) {
InputStream digestStream = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
digestStream = new DigestInputStream(input, md5);
IOUtils.copy(digestStream, new NullOutputStream());
retu... | private boolean handlePart(Part p) throws MessagingException, GetterException {
String filename = p.getFileName();
if (!p.isMimeType("multipart/*")) {
String disp = p.getDisposition();
if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT)) {
if (checkCrit... | true |
2,089 | 562,437 | 20,826,358 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | public String generateDigest(String password, String saltHex, String algorithm) throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase("crypt")) {
return "{CRYPT}" + UnixCrypt.crypt(password);
} else if (algorithm.equalsIgnoreCase("sha")) {
algorithm = "SHA-1";
... | false |
2,090 | 4,818,089 | 14,310,068 | public List<String[]> getCSV(String name) {
return new ResourceLoader<List<String[]>>(name) {
@Override
protected List<String[]> get(URL url) throws Exception {
CSVReader reader = null;
try {
reader = new CSVReader(new InputStreamR... | protected Boolean lancerincident(long idbloc, String Etatbloc, java.util.GregorianCalendar datebloc, long idServeur, String niveau, String message) {
String codeerr;
Boolean retour = false;
Boolean SauvegardeEtatAutocommit;
int etat;
acgtools_core.AcgIO.SortieLog(new Date() +... | false |
2,091 | 4,497,273 | 22,926,731 | private String fetchLocalPage(String page) throws IOException {
final String fullUrl = HOST + page;
LOG.debug("Fetching local page: " + fullUrl);
URL url = new URL(fullUrl);
URLConnection connection = url.openConnection();
StringBuilder sb = new StringBuilder();
Buffe... | public void testDelegateUsage() throws IOException {
MockControl elementParserControl = MockControl.createControl(ElementParser.class);
ElementParser elementParser = (ElementParser) elementParserControl.getMock();
elementParserControl.replay();
URL url = getClass().getResource("/net/... | false |
2,092 | 20,081,426 | 19,267,854 | private static GSP loadGSP(URL url) {
try {
InputStream input = url.openStream();
int c;
while ((c = input.read()) != -1) {
result = result + (char) c;
}
Unmarshaller unmarshaller = getUnmarshaller();
unmarshaller.setVal... | public static void insertTableData(Connection dest, TableMetaData tableMetaData) throws Exception {
PreparedStatement ps = null;
try {
dest.setAutoCommit(false);
String sql = "INSERT INTO " + tableMetaData.getSchema() + "." + tableMetaData.getTableName() + " (";
f... | false |
2,093 | 9,135,964 | 12,214,442 | private BufferedReader getReader(final String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
} catch (FileNotFoundException e) {
URL url = new URL(fileUrl);
reader = new InputStreamReader(url.openStream());
... | public boolean saveTemplate(Template t) {
try {
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
String query;
ResultSet rset;
if (Integer.parseInt(executeMySQLGet("SELECT COUNT(*) FROM templates WHERE name='" + escapeCharacters(... | false |
2,094 | 14,288,802 | 9,856,200 | static Object read(String path, String encoding, boolean return_string) throws IOException {
InputStream in;
if (path.startsWith("classpath:")) {
path = path.substring("classpath:".length());
URL url = Estimate.class.getClassLoader().getResource(path);
if (url == ... | public static void copyFile(File srcFile, File destFolder) {
try {
File destFile = new File(destFolder, srcFile.getName());
if (destFile.exists()) {
throw new BuildException("Could not copy " + srcFile + " to " + destFolder + " as " + destFile + " already exists");
... | false |
2,095 | 1,618,640 | 14,032,835 | private void initialize(OAIRepository repo, String u, String v, String params) throws OAIException {
oParent = repo;
strVerb = v;
strBaseURL = u;
strParams = params;
strResumptionToken = "";
iResumptionCount = 0;
boolInitialized = false;
boolValidRespo... | private byte[] szyfrujKlucz(byte[] kluczSesyjny) {
byte[] zaszyfrowanyKlucz = null;
byte[] klucz = null;
try {
MessageDigest skrot = MessageDigest.getInstance("SHA-1");
skrot.update(haslo.getBytes());
byte[] skrotHasla = skrot.digest();
Object ... | false |
2,096 | 14,650,349 | 23,206 | private ArrayList<XSPFTrackInfo> getPlaylist() {
try {
Log.d(TAG, "Getting playlist started");
String urlString = "http://" + mBaseURL + "/xspf.php?sk=" + mSession + "&discovery=0&desktop=1.4.1.57486";
if (mAlternateConn) {
urlString += "&api_key=9d1bbaef3... | public static BufferedReader getUserInfoStream(String name) throws IOException {
BufferedReader in;
try {
URL url = new URL("http://www.spoj.pl/users/" + name.toLowerCase() + "/");
in = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (MalformedURL... | false |
2,097 | 492,307 | 11,946,782 | public In(URL url) {
try {
URLConnection site = url.openConnection();
InputStream is = site.getInputStream();
scanner = new Scanner(is, charsetName);
scanner.useLocale(usLocale);
} catch (IOException ioe) {
System.err.println("Could not ope... | public static void addIntegrityEnforcements(Session session) throws HibernateException {
Transaction tx = null;
try {
tx = session.beginTransaction();
Statement st = session.connection().createStatement();
st.executeUpdate("DROP TABLE hresperformsrole;" + "CREATE ... | false |
2,098 | 1,955,681 | 14,763,206 | public static void ExtraeArchivoJAR(String Archivo, String DirJAR, String DirDestino) {
FileInputStream entrada = null;
FileOutputStream salida = null;
try {
File f = new File(DirDestino + separador + Archivo);
try {
f.createNewFile();
} ca... | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | true |
2,099 | 5,907,854 | 19,307,121 | @Override
public List<String> getNamedEntitites(String sentence) {
List<String> namedEntities = new ArrayList<String>();
try {
URL url = new URL(SERVICE_URL + "text=" + URLEncoder.encode(sentence, "UTF-8") + "&confidence=" + CONFIDENCE + "&support=" + SUPPORT);
URLConnect... | public static byte[] sendSmsRequest(String url, String param) {
byte[] bytes = null;
try {
URL httpurl = new URL(url);
HttpURLConnection httpConn = (HttpURLConnection) httpurl.openConnection();
httpConn.setRequestProperty("Accept-Language", "zh-CN");
h... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.