text string | label int64 |
|---|---|
[CLS] private static void loadFromZip() {
InputStream in = Resources.class.getResourceAsStream("data.zip");
if (in == null) {
return;
}
ZipInputStream zipIn = new ZipInputStream(in);
try {
while (true) {
ZipEntry entry = zipIn.getNextEntry(... | 1 |
[CLS] public String getSummaryText() {
if (summaryText == null) {
for (Iterator iter = xdcSources.values().iterator(); iter.hasNext(); ) {
XdcSource source = (XdcSource) iter.next();
File packageFile = new File(source.getFile().getParentFile(), "xdc-package.html");
... | 0 |
[CLS] private String determineGuardedHtml() {
StringBuffer buf = new StringBuffer();
if (m_guardedButtonPresent) {
buf.append("\n<span id='" + getHtmlIdPrefix() + PUSH_PAGE_SUFFIX + "' style='display:none'>\n");
String location = m_guardedHtmlLocation != null ? m_guardedHtmlLocat... | 0 |
[CLS] @Override
public void copierPhotos(FileInputStream fichierACopier, FileOutputStream fichierDestination) {
FileChannel in = null;
FileChannel out = null;
try {
in = fichierACopier.getChannel();
out = fichierDestination.getChannel();
in.transferTo(0, i... | 1 |
[CLS] public static void copy(String inputFile, String outputFile) throws Exception {
try {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | 1 |
[CLS] private static void setEnvEntry(File fromEAR, File toEAR, String ejbJarName, String envEntryName, String envEntryValue) throws Exception {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(fromEAR));
FileOutputStream fos = new FileOutputStream(toEAR);
ZipOutputStream tempZip ... | 1 |
[CLS] public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChanne... | 0 |
[CLS] 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 =... | 0 |
[CLS] 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)), Base6... | 0 |
[CLS] 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 =... | 1 |
[CLS] 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 =... | 0 |
[CLS] public void load(boolean isOrdered) throws ResourceInstantiationException {
try {
if (null == url) {
throw new ResourceInstantiationException("URL not specified (null).");
}
BufferedReader listReader;
listReader = new BomStrippingInputStreamR... | 0 |
[CLS] public static void doHttpPost(String urlName, byte[] data, String contentType, String cookieData) throws InteropException {
URL url = getAccessURL(urlName);
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
... | 0 |
[CLS] protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/jar");
byte[] bufor = new byte[BUF_LEN];
ServletContext context = getServletContext();
URL url = context.getResource(FILE_NAME... | 0 |
[CLS] public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | 0 |
[CLS] public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
} [SEP] public bool... | 1 |
[CLS] public void transform(String style, String spec, OutputStream out) throws IOException {
URL url = new URL(rootURL, spec);
InputStream in = new PatchXMLSymbolsStream(new StripDoctypeStream(url.openStream()));
transform(style, in, out);
in.close();
} [SEP] @SuppressWarnings("unch... | 0 |
[CLS] 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;... | 1 |
[CLS] public void run(IProgressMonitor runnerMonitor) throws CoreException {
try {
Map<String, File> projectFiles = new HashMap<String, File>();
IPath basePath = new Path("/");
for (File nextLocation : filesToZip) {
proj... | 0 |
[CLS] private Date getArtifactFileLastUpdate(Artifact artifact) {
URL url = null;
try {
url = new URL(baseUrl + artifact.getOrganisationName().replaceAll("\\.", "/") + "/" + artifact.getName().replaceAll("\\.", "/") + "/" + artifact.getVersion() + "/");
} catch (MalformedURLException... | 0 |
[CLS] @Override
public String toString() {
String charsetName = getCharsetName();
if (charsetName == null) charsetName = "ISO-8859-1";
try {
if (unzip) {
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArr... | 1 |
[CLS] private static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
if (!destFile.createNewFile()) {
throw new IOException("Destination file cannot be created: " + destFile.getPath());
}
}
FileChann... | 1 |
[CLS] private String convert(InputStream input, String encoding) throws Exception {
Process p = Runtime.getRuntime().exec("tidy -q -f /dev/null -wrap 0 --output-xml yes --doctype omit --force-output true --new-empty-tags " + emptyTags + " --quote-nbsp no -utf8");
Thread t = new CopyThread(input, p.getO... | 1 |
[CLS] void acessResource(ClassLoader cl, String resource) throws IOException {
URL url = cl.getResource(resource);
if (url == null) {
println("Ups can't find resource " + resource);
} else {
println("URL OK " + resource + " ->" + url);
InputStream is = url.ope... | 0 |
[CLS] public static final synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
System.err.println("Failed to load the MD5 MessageDigest. " + "We will be una... | 1 |
[CLS] public static String calculateHA1(String username, byte[] password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes(username, ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(DAAP_REALM, ISO_8859_1));
md.upd... | 0 |
[CLS] protected Document SendRequest(Document request) throws WsmanException {
HttpURLConnection conn = null;
Document response = null;
stampRequest(request);
boolean printDebug = System.getProperty("intel.management.wsman.debug", "false").equals("true");
int retry = 2;
w... | 0 |
[CLS] public FTPClient getFTP(final Credentials credentials, final String remoteFile) throws NumberFormatException, SocketException, IOException, AccessDeniedException {
String fileName = extractFilename(remoteFile);
String fileDirectory = getPathName(remoteFile).substring(0, getPathName(remoteFile).ind... | 0 |
[CLS] 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 = DcmObjectFact... | 1 |
[CLS] private void makeConn(String filename1, String filename2) {
String basename = "http://www.bestmm.com/";
String urlname = basename + filename1 + "/pic/" + filename2 + ".jpg";
URL url = null;
try {
url = new URL(urlname);
} catch (MalformedURLException e) {
... | 0 |
[CLS] private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
... | 0 |
[CLS] 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);
... | 1 |
[CLS] public static String getMD5Str(String source) {
String s = null;
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(s... | 1 |
[CLS] 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[0x100... | 1 |
[CLS] public void copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPath);
FileOutputStream fs... | 1 |
[CLS] public static String hashPassword(String password) {
String passwordHash = "";
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
sha1.reset();
sha1.update(password.getBytes());
Base64 encoder = new Base64();
passwordHash = ne... | 0 |
[CLS] public String insertBuilding() {
homeMap = homeMapDao.getHomeMapById(homeMap.getId());
homeBuilding.setHomeMap(homeMap);
Integer id = homeBuildingDao.saveHomeBuilding(homeBuilding);
String dir = "E:\\ganymede_workspace\\training01\\web\\user_buildings\\";
FileOutputStream f... | 1 |
[CLS] public MemoryTextBody(InputStream is, String mimeCharset) throws IOException {
this.mimeCharset = mimeCharset;
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
out.close();
... | 1 |
[CLS] public static void copyFile(File src, File dest) throws IOException {
log.debug("Copying file: '" + src + "' to '" + dest + "'");
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFro... | 1 |
[CLS] public static String digest(String str) {
StringBuffer sb = new StringBuffer();
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
md5.update(str.getBytes("ISO8859-1"));
byte[] array = md5.digest();
for (int x = 0; x < 16; x++) {
... | 0 |
[CLS] public static void fileCopy(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 bu... | 1 |
[CLS] private void updateUser(AddEditUserForm addform, HttpServletRequest request) throws Exception {
Session hbsession = HibernateUtil.currentSession();
try {
Transaction tx = hbsession.beginTransaction();
NvUsers user = (NvUsers) hbsession.load(NvUsers.class, addform.getLogin()... | 1 |
[CLS] public void moveRuleDown(String language, String tag, int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
... | 0 |
[CLS] 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)), Base6... | 1 |
[CLS] private void setInlineXML(Entry entry, DatastreamXMLMetadata ds) throws UnsupportedEncodingException, StreamIOException {
String content;
if (m_obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0) && (ds.DatastreamID.equals("SERVICE-PROFILE") || ds.DatastreamID.equals("WSDL"))) {
content... | 0 |
[CLS] 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(m... | 1 |
[CLS] public String uploadReport(Collection c) {
try {
String id = generateRandomId();
Iterator iter = c.iterator();
URL url = new URL(ZorobotSystem.props.getProperty("zoro.url") + "auplo2.jsp");
URLConnection connection = url.openConnection();
connect... | 0 |
[CLS] public static void copyFile4(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
IOUtils.copy(in, out);
in.close();
out.close();
} [SEP] public static String compressFile(String fileName) throws IOException ... | 1 |
[CLS] public static void copy(File from, File to, int bufferSize) throws IOException {
if (to.exists()) {
logger.info("File " + to + " exists, will replace it.");
to.delete();
}
to.getParentFile().mkdirs();
to.createNewFile();
FileInputStream ois = null;
... | 0 |
[CLS] public static void copyFile(FileInputStream source, FileOutputStream target) throws Exception {
FileChannel inChannel = source.getChannel();
FileChannel outChannel = target.getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOException e... | 1 |
[CLS] private void postObject(Object obj, String strURL) throws Exception {
print("entering post object");
URL url = new URL(strURL);
URLConnection urlConn = url.openConnection();
print("HttpNetworkMessageConnection.postObject:returned from url.openConnection()");
urlConn.setUseC... | 0 |
[CLS] public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;
URL url;
InputStream stream = null;
try {
url = new URL(masterUrl);
... | 0 |
[CLS] public void reset(String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setInt(1, currentPilot);
psta.setString(2, componentName);
... | 0 |
[CLS] public CandleSeries fetchSeries(final String symbol) throws Exception {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
cal.setTime(begin);
String beginYear = String.valueOf(cal.get(Calendar.YEAR));
String beginMonth = String.valueOf(cal.get(Calendar.MONTH));
... | 0 |
[CLS] public boolean verify(final char[] password, final String encryptedPassword) {
MessageDigest digest = null;
int size = 0;
String base64 = null;
if (encryptedPassword.regionMatches(true, 0, "{SHA}", 0, 5)) {
size = 20;
base64 = encryptedPassword.substring(5);... | 1 |
[CLS] public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileOutputStream fos = new FileOutputStream(out);
FileChannel outChannel = fos.getChannel();
try {
inChannel.transferTo(0, inChannel.size(),... | 1 |
[CLS] public static String[] bubbleSort(String[] unsortedString, boolean ascending) {
if (unsortedString.length < 2) return unsortedString;
String[] sortedString = new String[unsortedString.length];
for (int i = 0; i < unsortedString.length; i++) {
sortedString[i] = unsortedString[i]... | 0 |
[CLS] 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 =... | 1 |
[CLS] private static String format(String check) throws NoSuchAlgorithmException, UnsupportedEncodingException {
check = check.replaceAll(" ", "");
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(check.getBytes("ISO-8859-1"));
byte[] end = md5.digest();
String di... | 1 |
[CLS] private void preprocessImages(GeoImage[] detailedImages) throws IOException {
for (int i = 0; i < detailedImages.length; i++) {
BufferedImage img = loadImage(detailedImages[i].getPath());
detailedImages[i].setLatDim(img.getHeight());
detailedImages[i].setLonDim(img.getW... | 0 |
[CLS] protected Icon newIcon(String iconName) {
URL url = Utils.getResource(getFullPath(iconName, "/"), getClass());
if (url == null) {
if (getParent() != null) return getParent().getIcon(iconName);
return null;
}
try {
MethodCall getImage = new Method... | 0 |
[CLS] public static String getEncryptedPwd(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] pwd = null;
SecureRandom random = new SecureRandom();
byte[] salt = new byte[SALT_LENGTH];
random.nextBytes(salt);
MessageDigest md = null;
m... | 0 |
[CLS] 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)), Base6... | 1 |
[CLS] public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream... | 1 |
[CLS] private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.wri... | 1 |
[CLS] public void zip_compressFiles() throws Exception {
FileInputStream in = null;
File f1 = new File("C:\\WINDOWS\\regedit.exe");
File f2 = new File("C:\\WINDOWS\\win.ini");
File file = new File("C:\\" + NTUtil.class.getName() + ".zip");
ZipOutputStream out = new ZipOutputStrea... | 1 |
[CLS] 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[0x100... | 1 |
[CLS] public static Set<Street> getVias(String pURL) {
Set<Street> result = new HashSet<Street>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniVia = "<calle>";
String finVia = "</cal... | 0 |
[CLS] public static String getURL(String urlString, String getData, String postData) {
try {
if (getData != null) if (!getData.equals("")) urlString += "?" + getData;
URL url = new URL(urlString);
URLConnection connection = url.openConnection();
if (!postData.equa... | 0 |
[CLS] public String readURL(URL url) throws JasenException {
OutputStream out = new ByteArrayOutputStream();
InputStream in = null;
String html = null;
NonBlockingStreamReader reader = null;
try {
in = url.openStream();
reader = new NonBlockingStreamReader... | 0 |
[CLS] private HttpURLConnection connect() throws MalformedURLException, IOException {
HttpURLConnection connection = null;
if (repositoryLocation == null) {
Utils.debug("RemoteRepository", "repository Location unspecified");
return null;
}
URL url = new URL(reposi... | 0 |
[CLS] public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | 1 |
[CLS] public ProgramMessageSymbol addProgramMessageSymbol(int programID, String name, byte[] bytecode) throws AdaptationException {
ProgramMessageSymbol programMessageSymbol = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
Statement statement = null;
... | 0 |
[CLS] public static void writeToFile(final File file, final InputStream in) throws IOException {
IOUtils.createFile(file);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
IOUtils.copyStream(in, fos);
} finally {
IOUtils.closeIO(fos... | 1 |
[CLS] public final void run() {
active = true;
String s = findcachedir();
uid = getuid(s);
try {
File file = new File(s + "main_file_cache.dat");
if (file.exists() && file.length() > 0x3200000L) file.delete();
cache_dat = new RandomAccessFile(s + "main... | 0 |
[CLS] public static String getFileText(URL _url) {
try {
InputStream input = _url.openStream();
String content = IOUtils.toString(input);
IOUtils.closeQuietly(input);
return content;
} catch (Exception err) {
LOG.error(_url.toString(), err);
... | 0 |
[CLS] public static void copy(File source, File dest) throws BuildException {
dest = new File(dest, source.getName());
if (source.isFile()) {
byte[] buffer = new byte[4096];
FileInputStream fin = null;
FileOutputStream fout = null;
try {
fi... | 0 |
[CLS] protected int doExecuteInsert(PreparedStatement statement, Table data) throws SQLException {
ResultSet rs = null;
int result = -1;
try {
lastError = null;
result = statement.executeUpdate();
if (!isAutoCommit()) connection.commit();
rs = stat... | 1 |
[CLS] public static String getAnalysisServletOutput(String inputXml) {
java.io.BufferedWriter bWriter = null;
URLConnection connection = null;
String resultString = "";
bWriter = null;
connection = null;
String target = ServletConstant.ANALYSIS_SERVLET;
String mes... | 0 |
[CLS] public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), ou... | 1 |
[CLS] public SWORDEntry ingestDepost(final DepositCollection pDeposit, final ServiceDocument pServiceDocument) throws SWORDException {
try {
ZipFileAccess tZipFile = new ZipFileAccess(super.getTempDir());
LOG.debug("copying file");
String tZipTempFileName = super.getTempDir()... | 1 |
[CLS] 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;... | 0 |
[CLS] protected FTPClient ftpConnect() throws SocketException, IOException, NoSuchAlgorithmException {
FilePathItem fpi = getFilePathItem();
FTPClient f = new FTPClient();
f.connect(fpi.getHost());
f.login(fpi.getUsername(), fpi.getPassword());
return f;
} [SEP] public Instan... | 0 |
[CLS] public void write(HttpServletRequest req, HttpServletResponse res, Object bean) throws IntrospectionException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException {
res.setContentType(contentType);
final Object r;
if (HttpRpcServer.HttpRpcOutput.class.isAs... | 1 |
[CLS] private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.wri... | 1 |
[CLS] private void addConfigurationResource(final String fileName, final boolean ensureLoaded) {
try {
final ClassLoader cl = this.getClass().getClassLoader();
final Properties p = new Properties();
final URL url = cl.getResource(fileName);
if (url == null) {
... | 0 |
[CLS] @Transient
public byte[] getData() {
InputStream is = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
is = urlInstance.openStream();
byte[] bytes = new byte[1024 * 20];
while (is.available() > 0) {
int bytesRead =... | 0 |
[CLS] private static void writeOneAttachment(Context context, Writer writer, OutputStream out, Attachment attachment) throws IOException, MessagingException {
writeHeader(writer, "Content-Type", attachment.mMimeType + ";\n name=\"" + attachment.mFileName + "\"");
writeHeader(writer, "Content-Transfer-En... | 1 |
[CLS] public static Photo createPhoto(String title, String userLogin, String pathToPhoto, String basePathImage) throws NoSuchAlgorithmException, IOException {
String id = CryptSHA1.genPhotoID(userLogin, title);
String extension = pathToPhoto.substring(pathToPhoto.lastIndexOf("."));
String destin... | 1 |
[CLS] public boolean crear() {
int result = 0;
String sql = "insert into torneo" + "(nombreTorneo, ciudad, fechaInicio, fechaFinal, organizador, numeroDivisiones, terminado)" + "values (?, ?, ?, ?, ?, ?, ?)";
try {
connection = conexionBD.getConnection();
connection.setAu... | 0 |
[CLS] private File sendQuery(String query) throws MusicBrainzException {
File xmlServerResponse = null;
try {
xmlServerResponse = new File(SERVER_RESPONSE_FILE);
long start = Calendar.getInstance().getTimeInMillis();
System.out.println("\n\n+++++++++++++++++++++++++++... | 0 |
[CLS] public File copyLocalFileAsTempFileInExternallyAccessableDir(String localFileRef) throws IOException {
log.debug("copyLocalFileAsTempFileInExternallyAccessableDir");
File f = this.createTempFileInExternallyAccessableDir();
FileChannel srcChannel = new FileInputStream(localFileRef).getChann... | 1 |
[CLS] @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.get... | 0 |
[CLS] public static KUID createRandomID() {
MessageDigestInput randomNumbers = new MessageDigestInput() {
public void update(MessageDigest md) {
byte[] random = new byte[LENGTH * 2];
GENERATOR.nextBytes(random);
md.update(random);
}
... | 1 |
[CLS] public static String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw new WebDocRuntimeException(ex);
}
md.update(text.getBytes());
BigInteger hash = ne... | 1 |
[CLS] public RawCandidate getRawCandidate(long candId) throws BookKeeprCommunicationException {
try {
synchronized (httpClient) {
HttpGet req = new HttpGet(remoteHost.getUrl() + "/cand/" + Long.toHexString(candId));
req.setHeader("Accept-Encoding", "gzip");
... | 0 |
[CLS] private String getStoreName() {
try {
final MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(protectionDomain.getBytes());
final byte[] bs = digest.digest();
final StringBuffer sb = new StringBuffer(bs.length * 2);
for (int ... | 0 |
[CLS] public ByteArrayOutputStream download(final String contentUuid) throws WebServiceClientException {
try {
URL url = new URL(getPath("/download/" + contentUuid));
URLConnection connection = url.openConnection();
InputStream inputStream = connection.getInputStream();
... | 0 |
[CLS] private void convertClasses(File source, File destination) throws PostProcessingException, CodeCheckException, IOException {
Stack sourceStack = new Stack();
Stack destinationStack = new Stack();
sourceStack.push(source);
destinationStack.push(destination);
while (!sourceSt... | 1 |
[CLS] private Document saveFile(Document document, File file) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATEFORMAT_YYYYMMDD);
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
Preference preferenc... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.