This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void deletefile(File path) { | |
if (path.isDirectory()) { | |
for (File f : path.listFiles()) { | |
if (f.isDirectory()) deletefile(f); | |
else f.delete(); | |
} | |
} | |
path.delete(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String get_Md5_Hash(ReadableByteChannel bch) { | |
String checsumm = null; | |
MessageDigest md5; | |
try { | |
md5 = MessageDigest.getInstance("md5"); | |
md5.reset(); | |
ByteBuffer bb = ByteBuffer.allocate(1024); | |
while (bch.read(bb) != -1) { | |
bb.flip(); | |
md5.update(bb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Link createFolderInDisk(Field... field) throws NoSuchFieldError, ConnectException, FileNotFoundException, IOException { | |
//201 - ок | |
//409 - this folder there is , or is not | |
String operation = "/v1/disk/resources"; | |
Link link = new Link(); | |
try { | |
link = query.getObgect(Query.PUT, operation, field, Link.class); | |
} catch (ConnectException ex) { | |
if (query.getCode() == 409) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Link deleteFileOrFolder(Field... field) throws NoSuchFieldError, ConnectException, IOException { | |
String operation = "/v1/disk/resources"; | |
return query.getObgect(Query.DELETE, operation, field, Link.class); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Disk { | |
public Map<String, List<Resource>> getResource(); | |
public ReadableByteChannel read(String path)throws FileNotFoundException; | |
public void write(String path, ReadableByteChannel i); | |
public void deleteFolderOrFile(String path); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, String> result = new Gson().fromJson(sb.toString(), | |
new TypeToken<Map<String, String>>() {}.getType()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package javaapplication38; | |
import java.util.Collections; | |
import java.util.LinkedList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package ua.andxbes; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install -y lamp-server^ | |
sudo apt-get install -y phpmyadmin | |
echo "\n\n String to in end the document \n\n " | |
echo "Include /etc/phpmyadmin/apache.conf" | |
sudo gedit /etc/apache2/apache2.conf | |
sudo /etc/init.d/apache2 restart | |
echo "restarting" | |
firefox http://localhost/phpmyadmin http://localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install -y lamp-server^ | |
sudo apt-get install -y phpmyadmin | |
st="Include /etc/phpmyadmin/apache.conf" | |
configDocument="/etc/apache2/apache2.conf" | |
sudo bash -c "echo $st >> $configDocument " | |
cat $configDocument |
OlderNewer