func1 string | func2 string | label int64 |
|---|---|---|
public static void main(String[] args) throws Exception {
String codecClassname = args[0];
Class<?> codecClass = Class.forName(codecClassname);
Configuration conf = new Configuration();
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, conf);
... | public void load(String filename) throws VisbardException {
String defaultFilename = VisbardMain.getSettingsDir() + File.separator + DEFAULT_SETTINGS_FILE;
File defaultFile = new File(defaultFilename);
InputStream settingsInStreamFromFile = null;
try {
sLogger.info("Loadi... | 1 |
public static void copyFile(File file, String destDir) throws IOException {
if (!isCanReadFile(file)) throw new RuntimeException("The File can't read:" + file.getPath());
if (!isCanWriteDirectory(destDir)) throw new RuntimeException("The Directory can't write:" + destDir);
FileChannel srcCha... | public static void gunzip(File gzippedFile, File destinationFile) throws IOException {
int buffer = 2048;
FileInputStream in = new FileInputStream(gzippedFile);
GZIPInputStream zipin = new GZIPInputStream(in);
byte[] data = new byte[buffer];
FileOutputStream out = new FileOut... | 1 |
private static Manifest getManifest() throws IOException {
Stack manifests = new Stack();
for (Enumeration e = Run.class.getClassLoader().getResources(MANIFEST); e.hasMoreElements(); ) manifests.add(e.nextElement());
while (!manifests.isEmpty()) {
URL url = (URL) manifests.pop();... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | 0 |
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.isAssi... | public static void main(String[] args) throws Exception {
DES des = new DES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test1.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\test2.txt"));
SingleKey key = new SingleKe... | 1 |
public static void copyFile(File src, File dest) throws IOException {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
java.nio.channels.FileChannel channelSrc = fis.getChannel();
java.nio.channels.FileChannel channelDest = fos.getCha... | private String createVisadFile(String fileName) throws FileNotFoundException, IOException {
ArrayList<String> columnNames = new ArrayList<String>();
String visadFile = fileName + ".visad";
BufferedReader buf = new BufferedReader(new FileReader(fileName));
String firstLine = buf.readL... | 1 |
public static String encrypt(String password) {
String sign = password;
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(sign.getBytes());
byte[] hash = md.digest();
StringBuffer hexString = new StringBuf... | 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(... | 0 |
private void loadMap() {
final String wordList = "vietwordlist.txt";
try {
File dataFile = new File(supportDir, wordList);
if (!dataFile.exists()) {
final ReadableByteChannel input = Channels.newChannel(ClassLoader.getSystemResourceAsStream("dict/" + dataFile.... | 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... | 1 |
private String md5(String s) {
StringBuffer hexString = null;
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
hexString = new StringBuffer();
for (int i = 0... | protected byte[] createFileID() {
try {
COSDocument cosDoc = cosGetDoc();
if (cosDoc == null) {
return null;
}
ILocator locator = cosDoc.getLocator();
if (locator == null) {
return null;
}
IRa... | 1 |
public static EXISchema getEXISchema(String fileName, Class<?> cls, EXISchemaFactoryErrorHandler compilerErrorHandler) throws IOException, ClassNotFoundException, EXISchemaFactoryException {
EXISchemaFactory schemaCompiler = new EXISchemaFactory();
schemaCompiler.setCompilerErrorHandler(compilerErro... | public int unindexRecord(String uuid) throws SQLException, CatalogIndexException {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
int nRows = 0;
StringSet fids = new StringSet();
if (cswRemoteRepository.isActive()) {
StringS... | 0 |
private HttpURLConnection getRecognizedUrl(SpantusAudioCtx ctx) throws URISyntaxException {
try {
URL url = ctx.getRecognizedUrl();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Type", "application/json");
... | 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(... | 0 |
public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | private void runGetVendorProfile() {
DataStorage.clearVendorProfile();
GenericUrl url = new GoogleUrl(EnterpriseMarketplaceUrl.generateVendorProfileUrl());
VendorProfile vendorProfile = null;
try {
HttpRequest request = requestFactory.buildGetRequest(url);
req... | 0 |
private static byte[] createHash(EHashType hashType, String string) {
MessageDigest md;
try {
md = MessageDigest.getInstance(hashType.getJavaHashType());
md.reset();
md.update(string.getBytes());
byte[] byteResult = md.digest();
return byte... | private String readAboutText(String urlStr) {
String text = null;
try {
URL url = this.getClass().getResource(urlStr);
InputStreamReader reader = new InputStreamReader(url.openStream());
StringWriter writer = new StringWriter();
int character = reader.... | 0 |
void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | public static void joinFiles(FileValidator validator, File target, File[] sources) {
FileOutputStream fos = null;
try {
if (!validator.verifyFile(target)) return;
fos = new FileOutputStream(target);
FileInputStream fis = null;
byte[] bytes = new byte[5... | 0 |
public static void registerProviders(ResteasyProviderFactory factory) throws Exception {
Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources("META-INF/services/" + Providers.class.getName());
LinkedHashSet<String> set = new LinkedHashSet<String>();
while (en.has... | private static void grab(String urlString) throws MalformedURLException, IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
in =... | 1 |
public void applyTo(File source, File target) throws IOException {
boolean failed = true;
FileInputStream fin = new FileInputStream(source);
try {
FileChannel in = fin.getChannel();
FileOutputStream fos = new FileOutputStream(target);
... | @Override
protected void copyContent(String filename) throws IOException {
InputStream in = null;
try {
in = LOADER.getResourceAsStream(RES_PKG + filename);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, o... | 1 |
public void bubble() {
boolean test = false;
int kars = 0, tas = 0;
while (true) {
for (int j = 0; j < dizi.length - 1; j++) {
kars++;
if (dizi[j] > dizi[j + 1]) {
int temp = dizi[j];
dizi[j] = dizi[j + 1];
... | public void writeTo(OutputStream out) throws IOException {
if (!closed) {
throw new IOException("Stream not closed");
}
if (isInMemory()) {
memoryOutputStream.writeTo(out);
} else {
FileInputStream fis = new FileInputStream(outputFile);
... | 0 |
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 void copyHashAllFilesToDirectory(String baseDirStr, Hashtable newNamesTable, String destDirStr) throws Exception {
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.endsWith(sep)) {
destDirStr = dest... | 1 |
public void write(PDDocument doc) throws COSVisitorException {
document = doc;
SecurityHandler securityHandler = document.getSecurityHandler();
if (securityHandler != null) {
try {
securityHandler.prepareDocumentForEncryption(document);
this.willEn... | public void setPassword(String password) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes("UTF-8"));
byte[] digest = md.digest();
String encodedPassword = Base64.encode(digest);
this.password ... | 1 |
private static String fetchImageViaHttp(URL imgUrl) throws IOException {
String sURL = imgUrl.toString();
String imgFile = imgUrl.getPath();
HttpURLConnection cnx = (HttpURLConnection) imgUrl.openConnection();
String uri = null;
try {
cnx.setAllowUserInteraction(f... | @Override
protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (beforeServingFile(req, resp)) {
String pathInfo = req.getPathInfo();
Validate.notNull(pathInfo, "the path info is null -> the sevlet should be mapped ... | 1 |
public static String generateMessageId(String plain) {
byte[] cipher = new byte[35];
String messageId = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(plain.getBytes());
cipher = md5.digest();
StringBuffer sb = new... | public void criarTopicoQuestao(Questao q, Integer idTopico) throws SQLException {
PreparedStatement stmt = null;
String sql = "INSERT INTO questao_topico (id_questao, id_disciplina, id_topico) VALUES (?,?,?)";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1,... | 0 |
private void gravaOp(Vector<?> op) {
PreparedStatement ps = null;
String sql = null;
ResultSet rs = null;
int seqop = 0;
Date dtFabrOP = null;
try {
sql = "SELECT MAX(SEQOP) FROM PPOP WHERE CODEMP=? AND CODFILIAL=? AND CODOP=?";
ps = con.prepar... | protected void innerProcess(ProcessorURI curi) throws InterruptedException {
Pattern regexpr = curi.get(this, STRIP_REG_EXPR);
ReplayCharSequence cs = null;
try {
cs = curi.getRecorder().getReplayCharSequence();
} catch (Exception e) {
curi.getNonFatalFailures... | 0 |
public static String md5Encrypt(final String txt) {
String enTxt = txt;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.error("Error:", e);
}
if (null != md) {
byte... | public boolean isPasswordCorrect(String attempt) {
try {
MessageDigest digest = MessageDigest.getInstance(attempt);
digest.update(salt);
digest.update(attempt.getBytes("UTF-8"));
byte[] attemptHash = digest.digest();
return attemptHash.equals(hash)... | 1 |
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();
in.transferTo(0, in.size(), out);
} catch (Excep... | @Override
public LispObject execute(LispObject first, LispObject second) throws ConditionThrowable {
Pathname zipfilePathname = coerceToPathname(first);
byte[] buffer = new byte[4096];
try {
String zipfileNamestring = zipfilePathname.getNamestring();
if (zipfileNa... | 1 |
public int procesar() {
int mas = 0;
String uriOntologia = "", source = "", uri = "";
String fichOrigenHTML = "", fichOrigenLN = "";
String ficheroOutOWL = "";
md5 firma = null;
StringTokenV2 entra = null, entra2 = null, entra3 = null;
FileInputStream lengNat ... | public static List<String> extract(String zipFilePath, String destDirPath) throws IOException {
List<String> list = null;
ZipFile zip = new ZipFile(zipFilePath);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
... | 1 |
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.write... | private File uploadToTmp() {
if (fileFileName == null) {
return null;
}
File tmpFile = dataDir.tmpFile(shortname, fileFileName);
log.debug("Uploading dwc archive file for new resource " + shortname + " to " + tmpFile.getAbsolutePath());
InputStream input = null;
... | 1 |
private String hashString(String key) {
MessageDigest digest;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(key.getBytes());
byte[] hash = digest.digest();
BigInteger bi = new BigInteger(1, hash);
return Strin... | public Document getKmlStream(String streetname, String number, String neighbourhood, String city, String state) throws RotaException {
StringBuffer urlsb = new StringBuffer(resourceBundle.getString(Constants.URL_SEARCH));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Inp... | 0 |
protected static String encodePassword(String raw_password) throws DatabaseException {
String clean_password = validatePassword(raw_password);
try {
MessageDigest md = MessageDigest.getInstance(DEFAULT_PASSWORD_DIGEST);
md.update(clean_password.getBytes(DEFAULT_PASSWORD_ENCOD... | public void run(IAction action) {
Shell shell = new Shell();
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(shell);
viewer.setEditDomain(new DefaultEditDomain(null));
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.set... | 0 |
public String translate(String before, int translateType) throws CoreException {
if (before == null) throw new IllegalArgumentException("before is null.");
if ((translateType != ENGLISH_TO_JAPANESE) && (translateType != JAPANESE_TO_ENGLISH)) {
throw new IllegalArgumentException("Invalid ... | public void setTypeRefs(Connection conn) {
log.traceln("\tProcessing " + table + " references..");
try {
String query = " select distinct c.id, c.qualifiedname from " + table + ", CLASSTYPE c " + " where " + table + "." + reffield + " is null and " + table + "." + classnamefield + " = c.... | 0 |
public static long download(String address, String localFileName) throws Exception {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
long numWritten = 0;
try {
URL url = new URL(address);
out = new BufferedOutputStream(new Fi... | public static PipeID getPipeIDForService(ServiceDescriptor descriptor) {
PipeID id = null;
URI uri = descriptor.getUri();
if (uri != null) {
try {
id = (PipeID) IDFactory.fromURI(uri);
} catch (URISyntaxException e) {
throw new RuntimeE... | 0 |
public static boolean copy(File from, File to, Override override) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
FileChannel srcChannel = null;
FileChannel destChannel = null;
if (override == null) override = Override.NEWER;
switch(overri... | protected void sort(double[] a) throws Exception {
for (int i = a.length - 1; i >= 0; i--) {
boolean swapped = false;
for (int j = 0; j < i; j++) {
if (a[j] > a[j + 1]) {
double d = a[j];
a[j] = a[j + 1];
a[j... | 0 |
public static boolean copyFile(final File fileFrom, final File fileTo) {
assert fileFrom != null : "fileFrom is null";
assert fileTo != null : "fileTo is null";
LOGGER.info(buildLogString(COPY_FILE_INFO, new Object[] { fileFrom, fileTo }));
boolean error = true;
FileInputStre... | protected void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | 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... | public void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
FileO... | 1 |
public static InputStream getInputStream(String filepath) throws Exception {
if (isUrl(filepath)) {
URL url = URI.create(filepath).toURL();
return url.openStream();
} else {
return new FileInputStream(new File(filepath));
}
}
| private void doPOST(HttpURLConnection connection, InputStream inputXML) throws MessageServiceException {
try {
OutputStream requestStream = new BufferedOutputStream(connection.getOutputStream());
IOUtils.copyAndClose(inputXML, requestStream);
connection.connect();
... | 0 |
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... | public BufferedImage processUsingTemp(InputStream input, DjatokaDecodeParam params) throws DjatokaException {
File in;
try {
in = File.createTempFile("tmp", ".jp2");
FileOutputStream fos = new FileOutputStream(in);
in.deleteOnExit();
IOUtils.copyStream... | 1 |
public void compile(Project project) throws ProjectCompilerException {
List<Resource> resources = project.getModel().getResource();
for (Resource resource : resources) {
try {
IOUtils.copy(srcDir.getRelative(resource.getLocation()).getInputStream(), outDir.getRelative(res... | public boolean WriteFile(java.io.Serializable inObj, String fileName) throws Exception {
FileOutputStream out;
try {
SecretKey skey = null;
AlgorithmParameterSpec aps;
out = new FileOutputStream(fileName);
cipher = Cipher.getInstance(algorithm);
... | 0 |
public static void copy(final File src, final File dest) throws IOException {
OutputStream stream = new FileOutputStream(dest);
FileInputStream fis = new FileInputStream(src);
byte[] buffer = new byte[16384];
while (fis.available() != 0) {
int read = fis.read(buffer);
... | public void testJTLM_publish100_blockSize() throws Exception {
EXISchema corpus = EXISchemaFactoryTestUtil.getEXISchema("/JTLM/schemas/TLMComposite.xsd", getClass(), m_compilerErrors);
Assert.assertEquals(0, m_compilerErrors.getTotalCount());
GrammarCache grammarCache = new GrammarCache(corp... | 0 |
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.write... | public static void unzip(File zipInFile, File outputDir) throws Exception {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(zipInFile);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipInFile));
ZipEntry entry = (ZipEntry) zipInputStrea... | 1 |
public void execute(PaymentInfoMagcard payinfo) {
if (payinfo.getTotal().compareTo(BigDecimal.ZERO) > 0) {
try {
StringBuffer sb = new StringBuffer();
sb.append("x_login=");
sb.append(URLEncoder.encode(m_sCommerceID, "UTF-8"));
sb.a... | public void run() {
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
log.trace("passing in cookies: ", cookies);
connection.setRequestProperty("Cookie", cookies);
connection.getContent();
} catch (Exception e) {
... | 0 |
public List<BadassEntry> parse() {
mBadassEntries = new ArrayList<BadassEntry>();
try {
URL url = new URL(mUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
... | private void getViolationsReportBySLATIdYearMonth() throws IOException {
String xmlFile10Send = System.getenv("SLASOI_HOME") + System.getProperty("file.separator") + "Integration" + System.getProperty("file.separator") + "soap" + System.getProperty("file.separator") + "getViolationsReportBySLATIdYearMonth.x... | 0 |
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.write... | public static boolean copyFile(String fileIn, String fileOut) {
FileChannel in = null;
FileChannel out = null;
boolean retour = false;
try {
in = new FileInputStream(fileIn).getChannel();
out = new FileOutputStream(fileOut).getChannel();
in.transfe... | 1 |
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 void run() {
StringBuffer xml;
String tabName;
Element guiElement;
setBold(monitor.getReading());
setBold(monitor.getReadingStatus());
monitor.getReadingStatus().setText(" Working");
HttpMethod method = null;
xml = new StringBuffer();
... | 1 |
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.... | @Test
public void testWriteAndReadFirstLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | 1 |
private static void generateTIFF(Connection con, String category, String area_code, String topic_code, String timeseries, String diff_timeseries, Calendar time, String area_label, String raster_label, String image_label, String note, Rectangle2D bounds, Rectangle2D raster_bounds, String source_filename, String diff... | public static void copy(URL url, String outPath) throws IOException {
System.out.println("copying from: " + url + " to " + outPath);
InputStream in = url.openStream();
FileOutputStream fout = new FileOutputStream(outPath);
byte[] data = new byte[8192];
int read = -1;
... | 0 |
public String encrypt(String password) {
String encrypted_pass = "";
ByteArrayOutputStream output = null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
byte byte_array[] = md.digest();
... | protected byte[] getHashedID(String ID) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(ID.getBytes());
byte[] digest = md5.digest();
byte[] bytes = new byte[WLDB_ID_SIZE];
for (int i = 0; i < bytes... | 1 |
private static void unpackEntry(File destinationFile, ZipInputStream zin, ZipEntry entry) throws Exception {
if (!entry.isDirectory()) {
createFolders(destinationFile.getParentFile());
FileOutputStream fis = new FileOutputStream(destinationFile);
try {
IOU... | private void copy(File inputFile, File outputFile) {
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), "UTF-8"));
writer = new BufferedWriter(new OutputStreamWriter(new F... | 1 |
protected InputSource getInputSource(String pReferencingSystemId, String pURI) throws SAXException {
URL url = null;
if (pReferencingSystemId != null) {
try {
url = new URL(new URL(pReferencingSystemId), pURI);
} catch (MalformedURLException e) {
}... | public static void copy(File src, File dest) throws IOException {
if (dest.exists() && dest.isFile()) {
logger.fine("cp " + src + " " + dest + " -- Destination file " + dest + " already exists. Deleting...");
dest.delete();
}
final File parent = dest.getParentFile();
... | 0 |
public void actionPerformed(ActionEvent e) {
if (saveForWebChooser == null) {
ExtensionFileFilter fileFilter = new ExtensionFileFilter("HTML files");
fileFilter.addExtension("html");
saveForWebChooser = new JFileChooser();
saveForWebCho... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
if (System.getProperty("os.name").toUpperCase().indexOf("WIN") != -1) {
... | 1 |
public static void copyWithClose(InputStream is, OutputStream os) throws IOException {
try {
IOUtils.copy(is, os);
} catch (IOException ioe) {
try {
if (os != null) os.close();
} catch (Exception e) {
}
try {
... | public static final void copyFile(File argSource, File argDestination) throws IOException {
FileChannel srcChannel = new FileInputStream(argSource).getChannel();
FileChannel dstChannel = new FileOutputStream(argDestination).getChannel();
try {
dstChannel.transferFrom(srcChannel, ... | 1 |
public static void copyFile(String sourceName, String destName) throws IOException {
FileChannel sourceChannel = null;
FileChannel destChannel = null;
try {
sourceChannel = new FileInputStream(sourceName).getChannel();
destChannel = new FileOutputStream(destName).getC... | @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOn... | 1 |
public byte[] uniqueID(String name, String topic) {
String key;
byte[] id;
synchronized (cache_) {
key = name + "|" + topic;
id = (byte[]) cache_.get(key);
if (id == null) {
MessageDigest md;
try {
md = M... | public static final String MD5(String value) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String newValue = hash.toString(16);
return newValue;
}... | 1 |
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 =... | public Void doInBackground() {
setProgress(0);
for (int i = 0; i < uploadFiles.size(); i++) {
String filePath = uploadFiles.elementAt(i).getFilePath();
String fileName = uploadFiles.elementAt(i).getFileName();
String fileMsg = "Uploading fi... | 1 |
@Override
public boolean copyFile(String srcRootPath, String srcDir, String srcFileName, String destRootPath, String destDir, String destFileName) {
File srcPath = new File(srcRootPath + separator() + Database.getDomainName() + separator() + srcDir);
if (!srcPath.exists()) {
try {
... | @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... | 1 |
public T04MixedOTSDTMUnitTestCase(String name) throws java.io.IOException {
super(name);
java.net.URL url = ClassLoader.getSystemResource("host0.cosnaming.jndi.properties");
jndiProps = new java.util.Properties();
jndiProps.load(url.openStream());
}
| public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(File.separator) + 1, path.length()));
String name = imageName.substring(0, imageName.lastIndexOf('.'));
String extension = imageName.substring(imageNam... | 0 |
static Object loadPersistentRepresentationFromFile(URL url) throws PersistenceException {
PersistenceManager.persistenceURL.get().addFirst(url);
ObjectInputStream ois = null;
HierarchicalStreamReader reader = null;
XStream xstream = null;
try {
Reader inputReader ... | public void testSimpleHttpPostsChunked() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(20000);
byte[] data = new byte[size];
rnd.nextByte... | 0 |
@Override
public void onClick(View v) {
GsmCellLocation gcl = (GsmCellLocation) tm.getCellLocation();
int cid = gcl.getCid();
int lac = gcl.getLac();
int mcc = Integer.valueOf(tm.getNetworkOperator().substring(0, 3));
... | public void testIsVersioned() throws ServiceException, IOException {
JCRNodeSource emptySource = loadTestSource();
assertTrue(emptySource.isVersioned());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputStream contentIn = getClass().getRe... | 0 |
public String[] getFile() {
List<String> records = new ArrayList<String>();
FTPClient ftp = new FTPClient();
try {
int reply;
FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
ftp.configure(conf);
ftp.connect(host, port);
... | private void createNodes() {
try {
URL url = this.getClass().getResource("NodesFile.txt");
InputStreamReader inReader = new InputStreamReader(url.openStream());
BufferedReader inNodes = new BufferedReader(inReader);
String s;
while ((s = inNodes.re... | 0 |
private void saveFile(InputStream in, String fullPath) {
try {
File sysfile = new File(fullPath);
if (!sysfile.exists()) {
sysfile.createNewFile();
}
java.io.OutputStream out = new FileOutputStream(sysfile);
org.apache.commons.io.IO... | 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... | 1 |
public static void main(String[] args) throws IOException {
File inputFile = new File("D:/farrago.txt");
File outputFile = new File("D:/outagain.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()... | private boolean copyFiles(File sourceDir, File destinationDir) {
boolean result = false;
try {
if (sourceDir != null && destinationDir != null && sourceDir.exists() && destinationDir.exists() && sourceDir.isDirectory() && destinationDir.isDirectory()) {
File sourceFiles[]... | 1 |
public void test() throws Exception {
StorageString s = new StorageString("UTF-8");
s.addText("Test");
try {
s.getOutputStream();
fail("Should throw IOException as method not supported.");
} catch (IOException e) {
}
try {
s.getWrit... | public void download(RequestContext ctx) throws IOException {
if (ctx.isRobot()) {
ctx.forbidden();
return;
}
long id = ctx.id();
File bean = File.INSTANCE.Get(id);
if (bean == null) {
ctx.not_found();
return;
}
... | 1 |
private List _getWeathersFromYahoo(String city) {
System.out.println("== get weather information of " + city + " from yahoo ==");
try {
URL url = new URL(URL + cities.get(city).toString());
InputStream input = url.openStream();
SAXParserFactory factory = SAXParser... | @Override
public void render(IContentNode contentNode, Request req, Response resp, Application app, ServerInfo serverInfo) {
Node fileNode = contentNode.getNode();
try {
Node res = fileNode.getNode("jcr:content");
if (checkLastModified(res, req.getServletRequset(), resp.g... | 0 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2