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 |
|---|---|---|---|---|---|
899,600 | 15,396,083 | 18,396,375 | public static String digest(String algorithm, String text) {
MessageDigest mDigest = null;
try {
mDigest = MessageDigest.getInstance(algorithm);
mDigest.update(text.getBytes(ENCODING));
} catch (NoSuchAlgorithmException nsae) {
Logger.error(Encryptor.class... | public static String hash(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
}
ret... | true |
899,601 | 13,031,531 | 9,689,181 | protected String getOldHash(String text) {
String hash = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte[] digestedBytes = md.digest();
hash = HexUtils.convert(digestedBytes);
} catch (No... | public static String EncryptString(String method, String input) {
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
if (method.equals("SHA1") || method.equals("MD5")) {
try {
md = MessageDigest.getInstance(met... | true |
899,602 | 22,857,041 | 13,139,267 | public static String generate(String source) {
byte[] SHA = new byte[20];
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(source.getBytes());
SHA = digest.digest();
} catch (NoSuchAlgorithmException e) {
System.ou... | public static String descripta(String senha) throws GCIException {
LOGGER.debug(INICIANDO_METODO + "descripta(String)");
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
... | true |
899,603 | 15,710,690 | 14,350,198 | @SuppressWarnings("unused")
private String getMD5(String value) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return "";
}
md5.reset();
md5.update(value.getBytes());
byte[]... | public static String encripty(String toEncripty) {
if (toEncripty != null) {
try {
synchronized (toEncripty) {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(toEncripty.getBytes());
... | true |
899,604 | 555,928 | 18,661,682 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | public static OMElement createOMRequest(String file, int count, String[] documentIds) throws Exception {
ObjectFactory factory = new ObjectFactory();
SubmitDocumentRequest sdr = factory.createSubmitDocumentRequest();
IdType pid = factory.createIdType();
pid.setRoot("1.3.6.1.4.1.21367... | true |
899,605 | 4,293,344 | 21,273,058 | public ResourceBundle getResources() {
if (resources == null) {
String lang = userProps.getProperty("language");
lang = "en";
try {
URL myurl = getResource("Resources_" + lang.trim() + ".properties");
InputStream in = myurl.openStream();
... | public RobotList<Percentage> sort_decr_Percentage(RobotList<Percentage> list, String field) {
int length = list.size();
Index_value[] distri = new Index_value[length];
for (int i = 0; i < length; i++) {
distri[i] = new Index_value(i, list.get(i).percent);
}
boolea... | false |
899,606 | 21,947,196 | 6,865,572 | public synchronized String encrypt(final String pPassword) throws NoSuchAlgorithmException, UnsupportedEncodingException {
final MessageDigest md = MessageDigest.getInstance("SHA");
md.update(pPassword.getBytes("UTF-8"));
final byte raw[] = md.digest();
return BASE64Encoder.encodeBuf... | 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... | false |
899,607 | 2,942,515 | 23,232,384 | @Override
protected InputStream getResourceStream(String name) throws Exception {
final BundleEntry entry = cpm.findLocalEntry(name);
if (entry != null) return entry.getInputStream();
final URL url = cpm.getBaseData().getBundle().getResource(name);
if (url != null) return url.ope... | public static void main(String[] args) {
URL url = Thread.currentThread().getContextClassLoader().getResource("org/jeditor/resources/jeditor.properties");
try {
PropertyResourceBundle prb = new PropertyResourceBundle(url.openStream());
String version = prb.getString("version"... | false |
899,608 | 778,875 | 9,552,054 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
899,609 | 19,235,547 | 3,461,964 | protected BufferedImage handleRaremapsException() {
if (params.uri.startsWith("http://www.raremaps.com/cgi-bin/gallery.pl/detail/")) try {
params.uri = params.uri.replace("cgi-bin/gallery.pl/detail", "maps/medium");
URL url = new URL(params.uri);
URLConnection connection ... | public String useService(HashMap<String, String> input) {
String output = "";
if (input.size() < 1) {
return "";
}
String data = "";
try {
for (String key : input.keySet()) {
data += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEnco... | false |
899,610 | 5,824,705 | 19,841,852 | public Object execute(Connection connection) throws JAXRException {
RegistryObject registryObject = connection.getRegistryService().getBusinessQueryManager().getRegistryObject(id);
if (registryObject instanceof ExtrinsicObject) {
ExtrinsicO... | public static final boolean checkForUpdate(final String currentVersion, final String updateURL, boolean noLock) throws Exception {
try {
final String parentFDTConfDirName = System.getProperty("user.home") + File.separator + ".fdt";
final String fdtUpdateConfFileName = "update.propert... | true |
899,611 | 17,934,800 | 4,505,945 | private static String getRegistrationClasses() {
CentralRegistrationClass c = new CentralRegistrationClass();
String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
try {
Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MA... | private BinaryDocument documentFor(String code, String type, int diagramIndex) {
code = code.replaceAll("\n", "").replaceAll("\t", "").trim().replaceAll(" ", "%20");
StringBuilder builder = new StringBuilder("http://yuml.me/diagram/");
builder.append(type).append("/");
builder.append... | false |
899,612 | 4,822,222 | 27,715 | public static void copy(String srcFileName, String destFileName) throws IOException {
if (srcFileName == null) {
throw new IllegalArgumentException("srcFileName is null");
}
if (destFileName == null) {
throw new IllegalArgumentException("destFileName is null");
... | public static void main(String[] args) {
try {
int encodeFlag = 0;
if (args[0].equals("-e")) {
encodeFlag = Base64.ENCODE;
} else if (args[0].equals("-d")) {
encodeFlag = Base64.DECODE;
}
String infile = args[1];
... | true |
899,613 | 10,236,284 | 21,980,807 | public HashSet<String> queryResource(String resourceName, String propertyName) {
if (resourceName.startsWith("http://dbpedia.org/resource/")) {
resourceName = resourceName.substring(28);
}
try {
resourceName = resourceName.trim().replace(' ', '_');
resourc... | public void checkAndDownload(String statsUrl, RDFStatsUpdatableModelExt stats, Date lastDownload, boolean onlyIfNewer) throws DataSourceMonitorException {
if (log.isInfoEnabled()) log.info("Checking if update required for statistics of " + ds + "...");
HttpURLConnection urlConnection;
try {
... | false |
899,614 | 2,867,246 | 2,915,107 | public static void copyFile(File inputFile, File outputFile) throws IOException {
BufferedInputStream fr = new BufferedInputStream(new FileInputStream(inputFile));
BufferedOutputStream fw = new BufferedOutputStream(new FileOutputStream(outputFile));
byte[] buf = new byte[8192];
int n... | public static void unZip(String unZipfileName, String outputDirectory) throws IOException, FileNotFoundException {
FileOutputStream fileOut;
File file;
ZipEntry zipEntry;
ZipInputStream zipIn = new ZipInputStream(new BufferedInputStream(new FileInputStream(unZipfileName)), encoder);
... | true |
899,615 | 22,075,089 | 11,188,584 | public static void executa(String arquivo, String filial, String ip) {
String drive = arquivo.substring(0, 2);
if (drive.indexOf(":") == -1) drive = "";
Properties p = Util.lerPropriedades(arquivo);
String servidor = p.getProperty("servidor");
String impressora = p.getPropert... | public static void loadPlugins() {
Logger.trace("Loading plugins");
Enumeration<URL> urls = null;
try {
urls = Play.classloader.getResources("play.plugins");
} catch (Exception e) {
}
while (urls != null && urls.hasMoreElements()) {
URL url = u... | false |
899,616 | 5,523,389 | 9,353,181 | public static void copy(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();
... | JSONResponse execute() throws ServerException, RtmApiException, IOException {
HttpClient httpclient = new DefaultHttpClient();
URI uri;
try {
uri = new URI(this.request.getUrl());
HttpPost httppost = new HttpPost(uri);
HttpResponse response = httpclient.ex... | false |
899,617 | 7,187,035 | 614,390 | @Override
public byte[] read(String path) throws PersistenceException {
InputStream reader = null;
ByteArrayOutputStream sw = new ByteArrayOutputStream();
try {
reader = new FileInputStream(path);
IOUtils.copy(reader, sw);
} catch (Exception e) {
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
899,618 | 2,279,291 | 6,304,372 | public static String encrypt(String plainText) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new Exception(e.getMessage());
}
try {
md.update(plainText.... | public static String getUploadDeleteComboBox(String fromMode, String fromFolder, String action, String object, HttpSession session) {
FTPClient ftp = new FTPClient();
CofaxToolsUser user = (CofaxToolsUser) session.getAttribute("user");
StringBuffer links = new StringBuffer();
StringB... | false |
899,619 | 5,910,211 | 22,135,198 | private static String genRandomGUID(boolean secure) {
String valueBeforeMD5 = "";
String valueAfterMD5 = "";
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorith... | public void testCodingBeyondContentLimitFromFile() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 12... | false |
899,620 | 276,152 | 4,047,586 | public static void main(String[] args) throws Exception {
String linesep = System.getProperty("line.separator");
FileOutputStream fos = new FileOutputStream(new File("lib-licenses.txt"));
fos.write(new String("JCP contains the following libraries. Please read this for comments on copyright e... | public static void toValueSAX(Property property, Value value, int valueType, ContentHandler contentHandler, AttributesImpl na, Context context) throws SAXException, RepositoryException {
na.clear();
String _value = null;
switch(valueType) {
case PropertyType.DATE:
... | true |
899,621 | 14,689,323 | 9,591,960 | public void serveResource(HTTPResource resource, HttpServletRequest request, HttpServletResponse response) throws java.io.IOException {
Image image = (Image) resource;
log.debug("Serving: " + image);
URL url = image.getResourceURL();
int idx = url.toString().lastIndexOf(".");
... | protected Object serveFile(MyServerSocket socket, String filenm, URL url) {
PrintStream out = null;
InputStream in = null;
long len = 0;
try {
out = new PrintStream(socket.getOutputStream());
in = url.openStream();
len = in.available();
} c... | false |
899,622 | 17,402,775 | 8,054,454 | public String getResourceAsString(String name) throws IOException {
String content = null;
InputStream stream = aClass.getResourceAsStream(name);
if (stream != null) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
IOUtils.copyAndClose(stream, buffer);
... | public void sortIndexes() {
int i, j, count;
int t;
count = m_ItemIndexes.length;
for (i = 1; i < count; i++) {
for (j = 0; j < count - i; j++) {
if (m_ItemIndexes[j] > m_ItemIndexes[j + 1]) {
t = m_ItemIndexes[j];
m... | false |
899,623 | 17,597,670 | 6,483,359 | @Deprecated
public boolean backupLuceneIndex(int indexLocation, int backupLocation) {
boolean result = false;
try {
System.out.println("lucene backup started");
String indexPath = this.getIndexFolderPath(indexLocation);
String backupPath = this.getIndexFolderP... | private void unzipData(ZipFile zipfile, ZipEntry entry) {
if (entry.getName().equals("backUpExternalInfo.out")) {
File outputFile = new File("temp", entry.getName());
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
... | true |
899,624 | 6,061,403 | 11,776,522 | 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.... | protected File getFile(NameCategory category) throws IOException {
File home = new File(System.getProperty("user.dir"));
String fileName = String.format("%s.txt", category);
File file = new File(home, fileName);
if (file.exists()) {
return file;
} else {
... | true |
899,625 | 13,015,489 | 960,757 | public void prepareOutput(HttpServletRequest req) {
EaasyStreet.logTrace(METHOD_IN + className + OUTPUT_METHOD);
super.prepareOutput(req);
String content = Constants.EMPTY_STRING;
String rawContent = null;
List parts = null;
try {
URL url = new URL(sourceU... | public String getMethod(String url) {
logger.info("Facebook: @executing facebookGetMethod():" + url);
String responseStr = null;
try {
HttpGet loginGet = new HttpGet(url);
loginGet.addHeader("Accept-Encoding", "gzip");
HttpResponse response = httpClient.ex... | true |
899,626 | 17,068,622 | 19,141,603 | public static void main(String args[]) throws Exception {
File file = new File("D:/work/love.txt");
@SuppressWarnings("unused") ZipFile zipFile = new ZipFile("D:/work/test1.zip");
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream("D:/work/test1.zip"));
zos.setEncoding("G... | public static String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
899,627 | 9,558,449 | 20,970,925 | public int openUrl(String url, String method, Bundle params) {
int result = 0;
try {
if (method.equals("GET")) {
url = url + "?" + Utility.encodeUrl(params);
}
String response = "";
HttpURLConnection conn = (HttpURLConnection) new URL(u... | public static final String convertPassword(final String srcPwd) {
StringBuilder out;
MessageDigest md;
byte[] byteValues;
byte singleChar = 0;
try {
md = MessageDigest.getInstance("MD5");
md.update(srcPwd.getBytes());
byteValues = md.digest... | false |
899,628 | 5,691,586 | 1,896,089 | public static void main(String[] args) throws IOException {
String paramFileName = args[0];
BufferedReader inFile_params = new BufferedReader(new FileReader(paramFileName));
String cands_fileName = (inFile_params.readLine().split("\\s+"))[0];
String alignSrcCand_phrasal_fileName = (i... | public static void copyFileByNIO(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
899,629 | 2,532,321 | 12,821,749 | 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 static void fastBackup(File file) {
FileChannel in = null;
FileChannel out = null;
FileInputStream fin = null;
FileOutputStream fout = null;
try {
in = (fin = new FileInputStream(file)).getChannel();
out = (fout = new FileOutputStream(file.getAb... | true |
899,630 | 14,616,047 | 8,912,110 | public static String md5(final String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[FOUR_BYTES];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | private static void salvarArtista(Artista artista) throws Exception {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "insert into artista VALUES (?,?,?,?,?,?,?)";
ps = conn.prepareStatement(sql);
... | false |
899,631 | 7,132,185 | 19,660,641 | 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 static String MD5_hex(String p) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
md.update(p.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String ret = hash.toString(16);
return ret;
} catch (... | false |
899,632 | 10,453,631 | 14,075,551 | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
log().error("failed to encrypt the password.", e);
... | public void doFTP() throws BuildException {
FTPClient ftp = null;
try {
task.log("Opening FTP connection to " + task.getServer(), Project.MSG_VERBOSE);
ftp = new FTPClient();
if (task.isConfigurationSet()) {
ftp = FTPConfigurator.configure(ftp, tas... | false |
899,633 | 12,524,506 | 19,935,081 | public static void copyFile(File in, File outDir) throws IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
File out = new File(outDir, in.getName());
destinati... | public Object mapRow(ResultSet rs, int i) throws SQLException {
try {
BLOB blob = (BLOB) rs.getBlob(1);
OutputStream outputStream = blob.setBinaryStream(0L);
IOUtils.copy(inputStream, outputStream);
outputStream.close();
... | true |
899,634 | 12,049,052 | 20,275,058 | private Collection<Class<? extends Plugin>> loadFromResource(ClassLoader classLoader, String resource) throws IOException {
Collection<Class<? extends Plugin>> pluginClasses = new HashSet<Class<? extends Plugin>>();
Enumeration providerFiles = classLoader.getResources(resource);
if (!provide... | protected void doGetPost(HttpServletRequest req, HttpServletResponse resp, boolean post) throws ServletException, IOException {
if (responseBufferSize > 0) resp.setBufferSize(responseBufferSize);
String pathinfo = req.getPathInfo();
if (pathinfo == null) {
String urlstring = req.... | true |
899,635 | 20,081,426 | 746,929 | 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 main(String[] args) throws Exception {
String localSrc = args[0];
String dst = args[1];
InputStream in = new BufferedInputStream(new FileInputStream(localSrc));
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(dst), conf);... | false |
899,636 | 15,599,613 | 14,770,723 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | public static boolean copyFile(File dest, File source) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
try {
... | true |
899,637 | 3,375,714 | 20,273,405 | public void importarHistoricoDeCotacoesDosPapeis(File[] pArquivosTXT, boolean pApagarDadosImportadosAnteriormente, Andamento pAndamento) throws FileNotFoundException, SQLException {
if (pApagarDadosImportadosAnteriormente) {
Statement stmtLimpezaInicialDestino = conDestino.createStatement();
... | public static void decompress(final File file, final File folder, final boolean deleteZipAfter) throws IOException {
final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(file.getCanonicalFile())));
ZipEntry ze;
try {
while (null != (ze = zis.g... | false |
899,638 | 19,002,330 | 3,402,511 | public static void copyFile(File src, File dst) throws ResourceNotFoundException, ParseErrorException, Exception {
if (src.getAbsolutePath().endsWith(".vm")) {
copyVMFile(src, dst.getAbsolutePath().substring(0, dst.getAbsolutePath().lastIndexOf(".vm")));
} else {
FileInputStr... | private static FileEntry writeEntry(Zip64File zip64File, FileEntry targetPath, File toWrite, boolean compress) {
InputStream in = null;
EntryOutputStream out = null;
processAndCreateFolderEntries(zip64File, parseTargetPath(targetPath.getName(), toWrite), compress);
try {
... | true |
899,639 | 12,202,663 | 234,104 | private static byte[] finalizeStringHash(String loginHash) throws NoSuchAlgorithmException {
MessageDigest md5Hasher;
md5Hasher = MessageDigest.getInstance("MD5");
md5Hasher.update(loginHash.getBytes());
md5Hasher.update(LOGIN_FINAL_SALT);
return md5Hasher.digest();
}
| public static void main(String[] argv) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (Exception e) {
e.printStackTrace();
}
md.update("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".getBytes(), 0, 56);
... | true |
899,640 | 21,293,479 | 8,330,065 | public void removeGames(List<Game> games) throws SQLException {
Connection conn = ConnectionManager.getManager().getConnection();
PreparedStatement stm = null;
conn.setAutoCommit(false);
try {
for (Game game : games) {
stm = conn.prepareStatement(Statement... | @Test
public void testWriteAndReadBiggerUnbuffered() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start(... | false |
899,641 | 9,530,015 | 19,436,818 | public static void main(String[] args) throws Throwable {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("cas", "cas file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("o", "output directory").longName("outputDir").isRequired(tru... | private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException {
final File file = new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.image.name"));
final FileOutputStream fos = new FileOutputStream(file... | true |
899,642 | 20,603,864 | 11,507,466 | public static String 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();
... | public PollSetMessage(String username, String question, String title, String[] choices) {
this.username = username;
MessageDigest m = null;
try {
m = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
... | true |
899,643 | 14,867,997 | 153,271 | public String getResponse(URL url) throws OAuthException {
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String i... | public DataSet(String name, String type, URL docBase, String plotDir) {
sitename = name.toUpperCase();
data = new Vector[3];
data[0] = new Vector();
data[1] = new Vector();
data[2] = new Vector();
if (type == null) return;
plottype = type.toLowerCase();
... | false |
899,644 | 5,977,093 | 16,085,714 | public FileBean create(MimeTypeBean mimeType, SanBean san) throws SQLException {
long fileId = 0;
DataSource ds = getDataSource(DEFAULT_DATASOURCE);
Connection conn = ds.getConnection();
try {
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();... | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Currency curr = (Currency) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_CURRENCY"));
pst.setInt(1, curr.getId());
delete = pst.executeUpd... | true |
899,645 | 16,495,170 | 21,436,838 | @Override
public HostRecord addressForHost(String domainName) throws Exception {
String fullUrl = requestUrlStub + domainName;
URL url = new URL(fullUrl);
HttpURLConnection connection = null;
connection = null;
connection = (HttpURLConnection) url.openConnection();
... | protected void writeToResponse(InputStream stream, HttpServletResponse response) throws IOException {
OutputStream output = response.getOutputStream();
try {
IOUtils.copy(stream, output);
} finally {
try {
stream.close();
} finally {
... | false |
899,646 | 12,229,175 | 916,271 | public static void fileCopy(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(sourceFile);
fos = new ... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
899,647 | 21,302,551 | 4,579,115 | public static Document convertHtmlToXml(final InputStream htmlInputStream, final String classpathXsltResource, final String encoding) {
Parser p = new Parser();
javax.xml.parsers.DocumentBuilder db;
try {
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuil... | public void copy(String original, String copy) throws SQLException {
try {
OutputStream out = openFileOutputStream(copy, false);
InputStream in = openFileInputStream(original);
IOUtils.copyAndClose(in, out);
} catch (IOException e) {
throw Message.conv... | true |
899,648 | 1,630,148 | 20,601,755 | public static void replaceEntry(File file, String entryName, InputStream stream) throws PersistenceException {
try {
File temporaryFile = File.createTempFile("pmMDA_zargo", ".zargo");
temporaryFile.deleteOnExit();
FileInputStream inputStream = new FileInputStream(file);
... | public static File copyFile(File file) {
File src = file;
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChannel destinati... | true |
899,649 | 4,612,220 | 21,649,269 | private void copy(File source, File destination) throws PackageException {
try {
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(destination);
byte[] buff = new byte[1024];
int len;
while ((len = in.rea... | public void gzipCompress(String file) {
try {
File inputFile = new File(file);
FileInputStream fileinput = new FileInputStream(inputFile);
File outputFile = new File(file.substring(0, file.length() - 1) + "z");
FileOutputStream stream = new FileOutputStream(ou... | true |
899,650 | 22,841,783 | 13,772,485 | public GridDirectoryList(URL url) throws McIDASException {
try {
urlc = (AddeURLConnection) url.openConnection();
inputStream = new DataInputStream(new BufferedInputStream(urlc.getInputStream()));
} catch (IOException e) {
throw new McIDASException("Error opening ... | private static String getData(String myurl) throws Exception {
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
if (login) {
uc.setRequestProperty("Cookie", logincookie + ";" + xfsscookie);
}
br = new BufferedReader(new InputStreamReader(uc... | false |
899,651 | 6,244,937 | 17,752,236 | 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 synchronized DASMetaData fillInDASMetaData(URL url) throws DASException {
try {
con = (HttpURLConnection) url.openConnection();
dasRespVersion = con.getHeaderField("X-DAS-Version");
dasSchema = con.getHeaderField("X-DAS-SchemaName");
dasSchemaVersion = ... | false |
899,652 | 1,158,840 | 17,067,833 | public static int zipFile(File file_input, File dir_output) {
File zip_output = new File(dir_output, file_input.getName() + ".zip");
ZipOutputStream zip_out_stream;
try {
FileOutputStream out = new FileOutputStream(zip_output);
zip_out_stream = new ZipOutputStream(new... | 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 |
899,653 | 11,419,428 | 6,993,344 | public static JSGFRuleGrammar newGrammarFromJSGF(URL url, JSGFRuleGrammarFactory factory) throws JSGFGrammarParseException, IOException {
Reader reader;
BufferedInputStream stream = new BufferedInputStream(url.openStream(), 256);
JSGFEncoding encoding = getJSGFEncoding(stream);
if ((... | @Override
public void parse() throws DocumentException, IOException {
URL url = new URL(this.XMLAddress);
URLConnection con = url.openConnection();
BufferedReader bStream = new BufferedReader(new InputStreamReader(con.getInputStream()));
String str;
bStream.readLine();
... | false |
899,654 | 8,224,584 | 2,446,253 | @Override
public boolean checkConnection() {
int status = 0;
try {
URL url = new URL(TupeloProxy.endpoint);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
status = conn.getResponseCode();
} catch (Exception e) {
logger.s... | private int renumberOrderBy(long tableID) throws SnapInException {
int count = 0;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = getDataSource().getConnection();
con.setAutoCommit(false);
stmt = con.createSta... | false |
899,655 | 23,370,708 | 11,032,544 | private final long test(final boolean applyFilter, final int executionCount) throws NoSuchAlgorithmException, NoSuchPaddingException, FileNotFoundException, IOException, RuleLoadingException {
final boolean stripHtmlEnabled = true;
final boolean injectSecretTokensEnabled = true;
final boolea... | @Test
public void testExactCopySize() throws IOException {
final int size = Byte.SIZE + RANDOMIZER.nextInt(TEST_DATA.length - Long.SIZE);
final InputStream in = new ByteArrayInputStream(TEST_DATA);
final ByteArrayOutputStream out = new ByteArrayOutputStream(size);
final int cpySi... | true |
899,656 | 6,853,666 | 11,371,486 | public static void sendPostRequest() {
String data = "text=Eschirichia coli";
try {
URL url = new URL("http://taxonfinder.ubio.org/analyze?");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStre... | private static List<String> getContent(URL url) throws IOException {
final HttpURLConnection http = (HttpURLConnection) url.openConnection();
try {
http.connect();
final int code = http.getResponseCode();
if (code != 200) throw new IOException("IP Locator failed t... | false |
899,657 | 3,533,515 | 8,641,070 | public boolean saveVideoXMLOnWebserver(String text) {
boolean error = false;
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.getWebserver().getUrl());
System.out.println("Connected to " + this.getWebserver().getUrl() + ".");
... | public static void main(String[] args) {
String email = "josh888@byu.net";
String username = "josh8573";
String password = "josh8573";
String IDnumber = "3030";
double[] apogee = { 1000 };
double[] perigee = apogee;
double[] inclination = { 58.0 };
int... | true |
899,658 | 3,634,782 | 7,110,627 | public static void main(String[] args) {
paraProc(args);
CanonicalGFF cgff = new CanonicalGFF(gffFilename);
CanonicalGFF geneModel = new CanonicalGFF(modelFilename);
CanonicalGFF transcriptGff = new CanonicalGFF(transcriptFilename);
TreeMap ksTable1 = getKsTable(ksTable1Filen... | void loadListFile(String listFileName, String majorType, String minorType, String languages, String annotationType) throws MalformedURLException, IOException {
Lookup defaultLookup = new Lookup(listFileName, majorType, minorType, languages, annotationType);
URL lurl = new URL(listsURL, listFileName)... | false |
899,659 | 8,117,216 | 1,048,665 | private void copyLocalFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel()... | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | true |
899,660 | 5,157,858 | 9,591,165 | 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... | private void writeAndCheckFile(DataFileReader reader, String base, String path, String hash, Reference ref, boolean hashall) throws Exception {
Data data = ref.data;
File file = new File(base + path);
file.getParentFile().mkdirs();
if (Debug.level > 1) System.err.println("read file "... | true |
899,661 | 438,086 | 19,823,992 | 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 getHash(String key, boolean base64) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(key.getBytes());
if (base64) return new String(new Base64().encode(md.digest()), "UTF8"); else return new String(md.digest(), "UTF8");
}
| false |
899,662 | 2,994,948 | 16,625,249 | public JSONObject getTargetGraph(HttpSession session, JSONObject json) throws JSONException {
StringBuffer out = new StringBuffer();
Graph tgt = null;
MappingManager manager = (MappingManager) session.getAttribute(RuncibleConstants.MAPPING_MANAGER.key());
try {
tgt = mana... | @Override
public void loadTest(StoryCardModel story) {
String strUrl = story.getStoryCard().getAcceptanceTestUrl();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder loader;
try {
URL url = new URL(strUrl);
loader = fac... | false |
899,663 | 2,711,644 | 23,094,550 | 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 StringBuffer render(RenderEngine c) {
String logTime = null;
if (c.getWorkerContext() != null) {
logTime = c.getWorkerContext().getWorkerStart();
}
if (c.isBreakState() || !c.canRender("u")) {
return new StringBuffer();
}
StringBuffer bu... | true |
899,664 | 4,193,495 | 11,517,213 | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| private static void copyFile(File sourceFile, File destFile) {
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream... | true |
899,665 | 17,633,231 | 8,267,306 | private void openConnection() throws IOException {
connection = (HttpURLConnection) url.openConnection(Global.getProxy());
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml; ... | public void testWriteThreadsNoCompression() throws Exception {
Bootstrap bootstrap = new Bootstrap();
bootstrap.loadProfiles(CommandLineProcessorFactory.PROFILE.DB, CommandLineProcessorFactory.PROFILE.REST_CLIENT, CommandLineProcessorFactory.PROFILE.COLLECTOR);
final LocalLogFileWriter write... | false |
899,666 | 17,470,307 | 19,752,872 | private void createSoundbank(String testSoundbankFileName) throws Exception {
System.out.println("Create soundbank");
File packageDir = new File("testsoundbank");
if (packageDir.exists()) {
for (File file : packageDir.listFiles()) assertTrue(file.delete());
assertTrue... | 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();
... | true |
899,667 | 15,593,678 | 17,231,006 | 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 = ... | @Override
public String transformSingleFile(X3DEditorSupport.X3dEditor xed) {
Node[] node = xed.getActivatedNodes();
X3DDataObject dob = (X3DDataObject) xed.getX3dEditorSupport().getDataObject();
FileObject mySrc = dob.getPrimaryFile();
File mySrcF = FileUtil.toFile(mySrc);
... | true |
899,668 | 22,426,232 | 13,099,597 | public Element rootFromURL(URL url) throws org.jdom.JDOMException, java.io.IOException {
Element e;
try {
InputStream stream = new BufferedInputStream(url.openConnection().getInputStream());
return getRootViaURI(verify, stream);
} catch (org.jdom.input.JDOMParseExcept... | public void deleteGroup(String groupID) throws XregistryException {
try {
Connection connection = context.createConnection();
connection.setAutoCommit(false);
try {
PreparedStatement statement1 = connection.prepareStatement(DELETE_GROUP_SQL_MAIN);
... | false |
899,669 | 4,456,641 | 10,006,681 | private void copyFile(File srcFile, File destFile) throws IOException {
if (!(srcFile.exists() && srcFile.isFile())) throw new IllegalArgumentException("Source file doesn't exist: " + srcFile.getAbsolutePath());
if (destFile.exists() && destFile.isDirectory()) throw new IllegalArgumentException("Des... | public static void copyFile(File src, File dest, int bufSize, boolean force) throws IOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file: " + dest.getName());
}
... | true |
899,670 | 5,907,854 | 10,566,073 | @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 IntactOntology parseOboFile(URL url, boolean keepTemporaryFile) throws PsiLoaderException {
if (url == null) {
throw new IllegalArgumentException("Please give a non null URL.");
}
StringBuffer buffer = new StringBuffer(1024 * 8);
try {
System.out.printl... | true |
899,671 | 22,998,998 | 6,302,678 | public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel inputFileChannel = new FileInputStream(sourceFile).getChannel();
FileChannel outputFileChannel = new FileOutputStream(destFile).getChannel();
long offset = 0L;
long length = inputFileChannel.... | public ISpieler[] sortiereSpielerRamsch(ISpieler[] spieler) {
for (int i = 0; i < spieler.length; i++) {
for (int j = 0; j < spieler.length - 1; j++) {
if (werteAugen(spieler[j].getStiche()) > werteAugen(spieler[j + 1].getStiche())) {
ISpieler a = spieler[j];
... | false |
899,672 | 11,048,469 | 21,266,476 | public static String getContents(String urlStr) throws Exception {
String contents = "";
URL url = new URL(urlStr);
URLConnection openConnection = url.openConnection();
final char[] buffer = new char[1024 * 1024];
StringBuilder out = new StringBuilder();
Reader in = n... | public static String md5(String word) {
MessageDigest alg = null;
try {
alg = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
}
alg.reset();
a... | false |
899,673 | 20,081,426 | 11,930,427 | 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... | private static String getServiceResponse(final String requestName, final Template template, final Map variables) {
OutputStreamWriter outputWriter = null;
try {
final StringWriter writer = new StringWriter();
final VelocityContext context = new VelocityContext(variables);
... | false |
899,674 | 18,397,102 | 6,319,402 | protected void extractArchive(File archive) {
ZipInputStream zis = null;
FileOutputStream fos;
ZipEntry entry;
File curEntry;
int n;
try {
zis = new ZipInputStream(new FileInputStream(archive));
while ((entry = zis.getNextEntry()) != null) {
... | public static String genetateSHA256(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes("UTF-8"));
byte[] passWd = md.digest();
String hex = toHex(passWd);
return... | false |
899,675 | 4,579,205 | 357,303 | public static void copyFile(String source, String destination) throws IOException {
File srcDir = new File(source);
File[] files = srcDir.listFiles();
FileChannel in = null;
FileChannel out = null;
for (File file : files) {
try {
in = new FileInput... | public static String post(String strUrl, String strPostString) {
try {
URL url = new URL(strUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
... | false |
899,676 | 10,426,070 | 23,250,845 | public static long copy(File src, long amount, File dst) {
final int BUFFER_SIZE = 1024;
long amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputS... | private void unzipResource(final String resourceName, final File targetDirectory) throws IOException {
assertTrue(resourceName.startsWith("/"));
final URL resource = this.getClass().getResource(resourceName);
assertNotNull("Expected '" + resourceName + "' not found.", resource);
asse... | true |
899,677 | 5,837,430 | 10,005,879 | public Configuration load(URL url) throws ConfigurationException {
LOG.info("Configuring from url : " + url.toString());
try {
return load(url.openStream(), url.toString());
} catch (IOException ioe) {
throw new ConfigurationException("Could not configure from URL : "... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
HttpClient client = new DefaultHttpClient();
HttpGet httpGetRequest = new HttpGet("http://www.google.com/");
String line = "", responseString ... | false |
899,678 | 8,996,916 | 14,710,734 |
private void recvMessage(String from, String to) throws Exception {
ConnectionFactoryImpl factory = new ConnectionFactoryImpl();
Receiver receiver = null;
ProviderConnection connection = factory.createConnection(from, to);
Connection conn = DBUtil.getConnection();
PreparedS... | public static boolean writeFile(HttpServletResponse resp, File reqFile) {
boolean retVal = false;
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(reqFile));
IOUtils.copy(in, resp.getOutputStream());
logger.debug("File successf... | false |
899,679 | 20,352,327 | 4,208,869 | public XmldbURI createFile(String newName, InputStream is, Long length, String contentType) throws IOException, PermissionDeniedException, CollectionDoesNotExistException {
if (LOG.isDebugEnabled()) LOG.debug("Create '" + newName + "' in '" + xmldbUri + "'");
XmldbURI newNameUri = XmldbURI.create(ne... | public static void putNextJarEntry(JarOutputStream modelStream, String name, File file) throws IOException {
JarEntry entry = new JarEntry(name);
entry.setSize(file.length());
modelStream.putNextEntry(entry);
InputStream fileStream = new BufferedInputStream(new FileInputStream(file))... | true |
899,680 | 16,700,020 | 2,273,819 | public static byte[] computeMD5(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(s.getBytes());
return md.digest();
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
... | String digest(final UserAccountEntity account) {
try {
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(account.getUserId().getBytes("UTF-8"));
digest.update(account.getLastLogin().toString(... | true |
899,681 | 12,577,673 | 21,496,577 | public void performOk(final IProject project, final TomcatPropertyPage page) {
page.setPropertyValue("tomcat.jdbc.driver", c_drivers.getText());
page.setPropertyValue("tomcat.jdbc.url", url.getText());
page.setPropertyValue("tomcat.jdbc.user", username.getText());
... | private void regattaBackup() {
SwingWorker sw = new SwingWorker() {
Regatta lRegatta = fRegatta;
public Object construct() {
String fullName = lRegatta.getSaveDirectory() + lRegatta.getSaveName();
System.out.println(MessageFormat.format(res.getString... | true |
899,682 | 20,089,257 | 20,753,922 | public void store(String path, InputStream stream) throws IOException {
toIgnore.add(normalizePath(path));
ZipEntry entry = new ZipEntry(path);
zipOutput.putNextEntry(entry);
IOUtils.copy(stream, zipOutput);
zipOutput.closeEntry();
}
| public void doImport(File f, boolean checkHosp) throws Exception {
connector.getConnection().setAutoCommit(false);
File base = f.getParentFile();
ZipInputStream in = new ZipInputStream(new FileInputStream(f));
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
... | true |
899,683 | 5,523,389 | 4,599,608 | public static void copy(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();
... | public static void main(String[] args) {
try {
URL url = new URL("http://localhost:6557");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("HEAD");
int responseCode = conn.getResponseCode();
BufferedReader i... | false |
899,684 | 9,756,057 | 16,930,288 | public void writeToFile(File out) throws IOException, DocumentException {
FileChannel inChannel = new FileInputStream(pdf_file).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} ca... | public TempFileTextBody(InputStream is, String mimeCharset) throws IOException {
this.mimeCharset = mimeCharset;
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".txt");
OutputStream out = tempFile.getOutputStream();
... | true |
899,685 | 17,116,115 | 22,050,257 | public void assign() throws Exception {
if (proposalIds.equals("") || usrIds.equals("")) throw new Exception("No proposal or peer-viewer selected.");
String[] pids = proposalIds.split(",");
String[] uids = usrIds.split(",");
int pnum = pids.length;
int unum = uids.length;
... | private void importSources() {
InputOutput io = IOProvider.getDefault().getIO("Import Sources", false);
io.select();
PrintWriter pw = new PrintWriter(io.getOut());
pw.println("Beginning transaction....");
pw.println("Processing selected files:");
String[][] selectedFi... | false |
899,686 | 12,646,326 | 8,385,051 | private void weightAndPlaceClasses() {
int rows = getRows();
for (int curRow = _maxPackageRank; curRow < rows; curRow++) {
xPos = getHGap() / 2;
BOTLRuleDiagramNode[] rowObject = getObjectsInRow(curRow);
for (int i = 0; i < rowObject.length; i++) {
... | public void play() throws FileNotFoundException, IOException, NoSuchAlgorithmException, FTPException {
final int BUFFER = 2048;
String host = "ftp.genome.jp";
String username = "anonymous";
String password = "";
FTPClient ftp = null;
ftp = new FTPClient();
ftp... | false |
899,687 | 9,218,164 | 15,805,164 | public static String encode(String text) {
try {
byte[] hash = new byte[32];
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("UTF-8"), 0, text.length());
hash = md.digest();
return MD5.toHex(hash);
} catch (NoSu... | @Override
public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.reset();
digest.update(((String) salt).getBytes("UTF-8"));
St... | true |
899,688 | 7,682,331 | 12,542,684 | @org.junit.Test
public void testReadWrite() throws Exception {
final String reference = "testString";
final Reader reader = new StringReader(reference);
final StringWriter osString = new StringWriter();
final Reader teeStream = new TeeReaderWriter(reader, osString);
IOUti... | public ServiceAdapterIfc deploy(String session, String name, byte jarBytes[], String jarName, String serviceClass, String serviceInterface) throws RemoteException, MalformedURLException, StartServiceException, SessionException {
try {
File jarFile = new File(jarName);
jarName = jarFi... | true |
899,689 | 467,550 | 1,953,925 | 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 boolean deploy(MMedia[] media) {
if (this.getIP_Address().equals("127.0.0.1") || this.getName().equals("localhost")) {
log.warning("You have not defined your own server, we will not really deploy to localhost!");
return true;
}
FTPClient ftp = new FTPClient();
... | false |
899,690 | 5,195,056 | 16,869,671 | public String getData() throws ValueFormatException, RepositoryException, IOException {
InputStream is = getStream();
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
IOUtils.closeQuietly(is);
return sw.toString();
}
| public JavaCodeAnalyzer(String filenameIn, String filenameOut, String lineLength) {
try {
File tmp = File.createTempFile("JavaCodeAnalyzer", "tmp");
BufferedReader br = new BufferedReader(new FileReader(filenameIn));
BufferedWriter out = new BufferedWriter(new FileWriter(... | true |
899,691 | 2,386,120 | 15,831,694 | @Override
public void setContentAsStream(InputStream input) throws IOException {
BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(htmlFile));
try {
IOUtils.copy(input, output);
} finally {
output.close();
}
if (this.getLa... | 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... | true |
899,692 | 288,978 | 20,009,109 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public static void concatFiles(final String as_base_file_name) throws IOException, FileNotFoundException {
new File(as_base_file_name).createNewFile();
final OutputStream lo_out = new FileOutputStream(as_base_file_name, true);
int ln_part = 1, ln_readed = -1;
final byte[] lh_buffer =... | true |
899,693 | 11,107,871 | 2,247,987 | private static Reader getReader(String fname) throws IOException {
InputStream is;
if (isUrl(fname)) {
URL url = new URL(fname);
is = url.openStream();
} else {
is = new FileInputStream(fname);
}
if (fname.endsWith(".zip")) {
is... | public static void main(String argv[]) {
Matrix A, B, C, Z, O, I, R, S, X, SUB, M, T, SQ, DEF, SOL;
int errorCount = 0;
int warningCount = 0;
double tmp, s;
double[] columnwise = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12. };
double[] rowwise = { 1., 4., 7., 1... | false |
899,694 | 1,675,976 | 5,444,166 | public void setPilot(PilotData pilotData) throws UsernameNotValidException {
try {
if (pilotData.username.trim().equals("") || pilotData.password.trim().equals("")) throw new UsernameNotValidException(1, "Username or password missing");
PreparedStatement psta;
if (pilotDa... | public static Image readImage(URL url, ImageMimeType type, int page) throws IOException {
if (type.javaNativeSupport()) {
return ImageIO.read(url.openStream());
} else if ((type.equals(ImageMimeType.DJVU)) || (type.equals(ImageMimeType.VNDDJVU)) || (type.equals(ImageMimeType.XDJVU))) {
... | false |
899,695 | 8,546,232 | 746,929 | public void execute(File sourceFile, File destinationFile, Properties htmlCleanerConfig) {
FileReader reader = null;
Writer writer = null;
try {
reader = new FileReader(sourceFile);
logger.info("Using source file: " + trimPath(userDir, sourceFile));
if (!d... | public static void main(String[] args) throws Exception {
String localSrc = args[0];
String dst = args[1];
InputStream in = new BufferedInputStream(new FileInputStream(localSrc));
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(dst), conf);... | true |
899,696 | 413,237 | 12,776,420 | 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 Bitmap getImage() throws IOException {
int recordBegin = 78 + 8 * mCount;
Bitmap result = null;
FileChannel channel = new FileInputStream(mFile).getChannel();
channel.position(mRecodeOffset[mPage]);
ByteBuffer bodyBuffer;
if (mPage + 1 < mCount) {
i... | true |
899,697 | 9,405,784 | 17,630,909 | public void startImport(ActionEvent evt) {
final PsiExchange psiExchange = PsiExchangeFactory.createPsiExchange(IntactContext.getCurrentInstance().getSpringContext());
for (final URL url : urlsToImport) {
try {
if (log.isInfoEnabled()) log.info("Importing: " + url);
... | public static int[] sortAscending(double input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] > input[j + 1]) {
... | false |
899,698 | 5,026,545 | 16,083,957 | public void writeConfigurationFile() throws IOException, ComponentException {
SystemConfig config = parent.getParentSystem().getConfiguration();
File original = config.getLocation();
File backup = new File(original.getParentFile(), original.getName() + "." + System.currentTimeMillis());
... | protected void createValueListAnnotation(IProgressMonitor monitor, IPackageFragment pack, Map model) throws CoreException {
IProject pj = pack.getJavaProject().getProject();
QualifiedName qn = new QualifiedName(JstActivator.PLUGIN_ID, JstActivator.PACKAGE_INFO_LOCATION);
String location = pj... | true |
899,699 | 7,760,801 | 354,276 | 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.... | private static Result request(AbstractHttpClient client, HttpUriRequest request) throws ClientProtocolException, IOException {
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
Result result = new Result();
result.setStatusCode(response.getSta... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.